File indexing completed on 2026-09-24 09:17:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef _RWObj_Tools_HeaderFile
0016 #define _RWObj_Tools_HeaderFile
0017
0018 #include <gp_XYZ.hxx>
0019 #include <NCollection_Vec3.hxx>
0020 #include <Standard_TypeDef.hxx>
0021 #include <TCollection_AsciiString.hxx>
0022
0023
0024 namespace RWObj_Tools
0025 {
0026
0027 inline bool ReadVec3(const char* thePos, char*& theNext, NCollection_Vec3<float>& theVec)
0028 {
0029 const char* aPos = thePos;
0030 theVec.x() = (float)Strtod(aPos, &theNext);
0031 aPos = theNext;
0032 theVec.y() = (float)Strtod(aPos, &theNext);
0033 aPos = theNext;
0034 theVec.z() = (float)Strtod(aPos, &theNext);
0035 return aPos != theNext;
0036 }
0037
0038
0039 inline bool ReadVec3(const char* thePos, char*& theNext, gp_XYZ& theVec)
0040 {
0041 const char* aPos = thePos;
0042 theVec.SetX(Strtod(aPos, &theNext));
0043 aPos = theNext;
0044 theVec.SetY(Strtod(aPos, &theNext));
0045 aPos = theNext;
0046 theVec.SetZ(Strtod(aPos, &theNext));
0047 return aPos != theNext;
0048 }
0049
0050
0051 inline bool ReadName(const char* thePos, TCollection_AsciiString& theName)
0052 {
0053 int aFrom = 0;
0054 int aTail = (int)std::strlen(thePos) - 1;
0055 if (aTail >= 0 && thePos[aTail] == '\n')
0056 {
0057 --aTail;
0058 }
0059 if (aTail >= 0 && thePos[aTail] == '\r')
0060 {
0061 --aTail;
0062 }
0063 for (; aTail >= 0 && IsSpace(thePos[aTail]); --aTail)
0064 {
0065 }
0066 for (; aFrom < aTail && IsSpace(thePos[aFrom]); ++aFrom)
0067 {
0068 }
0069 if (aFrom > aTail)
0070 {
0071 theName.Clear();
0072 return false;
0073 }
0074 theName = TCollection_AsciiString(thePos + aFrom, aTail - aFrom + 1);
0075 return true;
0076 }
0077
0078
0079 inline bool isSpaceChar(const char theChar)
0080 {
0081 return theChar == ' ' || theChar == '\t';
0082
0083 }
0084 }
0085
0086 #endif