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
27
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 = nullptr, Vector3<T>* n = nullptr );
38template<typename T>
39[[deprecated( "use parsePtsCoordinate( str, v, &c ) instead" )]]
40Expected<void> parsePtsCoordinate( const std::string_view& str, Vector3<T>& v, Color& c )
41{
42 return parsePtsCoordinate( str, v, &c );
43}
44
46MRMESH_API Expected<void> parseFirstNum( const std::string_view& str, int& num );
50MRMESH_API Expected<void> parsePolygon( const std::string_view& str, VertId* vertId, int* numPoints );
51
52template<typename T>
53[[deprecated( "use parseTextCoordinate() instead")]]
54Expected<void> parseAscCoordinate( const std::string_view& str, Vector3<T>& v, Vector3<T>* n = nullptr, Color* c = nullptr );
55
56template<typename T>
57Expected<void> parseSingleNumber( const std::string_view& str, T& num );
58
60MRMESH_API bool hasBom( const std::string_view& str );
61
62}
#define MRMESH_API
Definition MRMeshFwd.h:80
Expected< void > parsePolygon(const std::string_view &str, VertId *vertId, int *numPoints)
Expected< void > parsePtsCoordinate(const std::string_view &str, Vector3< T > &v, Color *c=nullptr, Vector3< T > *n=nullptr)
Expected< void > parseSingleNumber(const std::string_view &str, T &num)
MR_BIND_IGNORE Expected< std::string > readString(std::istream &in)
ImVec2 size(const ViewportRectangle &rect)
Definition MRViewport.h:32
tl::expected< T, E > Expected
Definition MRExpected.h:31
MR_BIND_IGNORE Expected< Buffer< char > > readCharBuffer(std::istream &in)
reads input stream to monolith char block
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
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
Expected< void > parseFirstNum(const std::string_view &str, int &num)
reads the first integer number in the line
std::vector< size_t > splitByLines(const char *data, size_t size)
returns offsets for each new line in monolith char block
bool hasBom(const std::string_view &str)
checks if the given string starts with the UTF-8 byte-order mark
Expected< void > parseAscCoordinate(const std::string_view &str, Vector3< T > &v, Vector3< T > *n=nullptr, Color *c=nullptr)
MR_BIND_IGNORE std::streamoff getStreamSize(std::istream &in)
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRColor.h:12
Definition MRVector3.h:33