File indexing completed on 2025-01-18 10:04:43
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 <Graphic3d_Vec3.hxx>
0020 #include <TCollection_AsciiString.hxx>
0021
0022
0023 namespace RWObj_Tools
0024 {
0025
0026 inline bool ReadVec3 (const char* thePos,
0027 char*& theNext,
0028 Graphic3d_Vec3& theVec)
0029 {
0030 const char* aPos = thePos;
0031 theVec.x() = (float )Strtod (aPos, &theNext);
0032 aPos = theNext;
0033 theVec.y() = (float )Strtod (aPos, &theNext);
0034 aPos = theNext;
0035 theVec.z() = (float )Strtod (aPos, &theNext);
0036 return aPos != theNext;
0037 }
0038
0039
0040 inline bool ReadVec3 (const char* thePos,
0041 char*& theNext,
0042 gp_XYZ& theVec)
0043 {
0044 const char* aPos = thePos;
0045 theVec.SetX (Strtod (aPos, &theNext));
0046 aPos = theNext;
0047 theVec.SetY (Strtod (aPos, &theNext));
0048 aPos = theNext;
0049 theVec.SetZ (Strtod (aPos, &theNext));
0050 return aPos != theNext;
0051 }
0052
0053
0054 inline bool ReadName (const char* thePos,
0055 TCollection_AsciiString& theName)
0056 {
0057 Standard_Integer aFrom = 0;
0058 Standard_Integer aTail = (Standard_Integer )std::strlen (thePos) - 1;
0059 if (aTail >= 0 && thePos[aTail] == '\n') { --aTail; }
0060 if (aTail >= 0 && thePos[aTail] == '\r') { --aTail; }
0061 for (; aTail >= 0 && IsSpace (thePos[aTail]); --aTail) {}
0062 for (; aFrom < aTail && IsSpace (thePos[aFrom]); ++aFrom) {}
0063 if (aFrom > aTail)
0064 {
0065 theName.Clear();
0066 return false;
0067 }
0068 theName = TCollection_AsciiString (thePos + aFrom, aTail - aFrom + 1);
0069 return true;
0070 }
0071
0072
0073 inline bool isSpaceChar (const char theChar)
0074 {
0075 return theChar == ' '
0076 || theChar == '\t';
0077
0078 }
0079 }
0080
0081 #endif