MeshLib C++ Docs
Loading...
Searching...
No Matches
MRIOParsing.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
3#include "MRExpected.h"
4#include "MRBuffer.h"
5#include "MRPch/MRBindingMacros.h"
6#include <istream>
7
8namespace MR
9{
12
13
15MRMESH_API std::vector<size_t> splitByLines( const char* data, size_t size );
16
21MRMESH_API MR_BIND_IGNORE std::streamoff getStreamSize( std::istream& in );
22
26MRMESH_API MR_BIND_IGNORE Expected<std::string> readString( std::istream& in );
27
29MRMESH_API MR_BIND_IGNORE Expected<Buffer<char>> readCharBuffer( std::istream& in );
30
32template<typename T>
33Expected<void> parseTextCoordinate( const std::string_view& str, Vector3<T>& v, Vector3<T>* n = nullptr, Color* c = nullptr );
34template<typename T>
35Expected<void> parseObjCoordinate( const std::string_view& str, Vector3<T>& v, Vector3<T>* c = nullptr );
36template<typename T>
37Expected<void> parsePtsCoordinate( const std::string_view& str, Vector3<T>& v, Color& c );
38
40MRMESH_API Expected<void> parseFirstNum( const std::string_view& str, int& num );
44MRMESH_API Expected<void> parsePolygon( const std::string_view& str, VertId* vertId, int* numPoints );
45
46template<typename T>
47[[deprecated( "use parseTextCoordinate() instead")]]
48Expected<void> parseAscCoordinate( const std::string_view& str, Vector3<T>& v, Vector3<T>* n = nullptr, Color* c = nullptr );
49
50template<typename T>
51Expected<void> parseSingleNumber( const std::string_view& str, T& num );
52
54MRMESH_API bool hasBom( const std::string_view& str );
55
56}
Expected< void > parseSingleNumber(const std::string_view &str, T &num)
ImVec2 size(const ViewportRectangle &rect)
Definition MRViewport.h:32
MRMESH_API std::vector< size_t > splitByLines(const char *data, size_t size)
returns offsets for each new line in monolith char block
MRMESH_API bool hasBom(const std::string_view &str)
checks if the given string starts with the UTF-8 byte-order mark
MRMESH_API MR_BIND_IGNORE std::streamoff getStreamSize(std::istream &in)
tl::expected< T, E > Expected
Definition MRExpected.h:31
MRMESH_API MR_BIND_IGNORE Expected< std::string > readString(std::istream &in)
Expected< void > parseTextCoordinate(const std::string_view &str, Vector3< T > &v, Vector3< T > *n=nullptr, Color *c=nullptr)
read coordinates to v separated by space
MRMESH_API Expected< void > parsePolygon(const std::string_view &str, VertId *vertId, int *numPoints)
MRMESH_API Expected< void > parseFirstNum(const std::string_view &str, int &num)
reads the first integer number in the line
Expected< void > parseObjCoordinate(const std::string_view &str, Vector3< T > &v, Vector3< T > *c=nullptr)
std::array< Vector3f, 3 > MR_BIND_IGNORE
Definition MRMeshBuilderTypes.h:13
MRMESH_API MR_BIND_IGNORE Expected< Buffer< char > > readCharBuffer(std::istream &in)
reads input stream to monolith char block
Expected< void > parsePtsCoordinate(const std::string_view &str, Vector3< T > &v, Color &c)
Expected< void > parseAscCoordinate(const std::string_view &str, Vector3< T > &v, Vector3< T > *n=nullptr, Color *c=nullptr)
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRColor.h:12
Definition MRVector3.h:33