mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
avoided some unneeded conversions of string::npos, minor cleanup of className
- string doesn't use any debug info, remove it - restructured the macros to add in NoDebug macro versions to className, typeInfo. Might be helpful with tackling the globals bootstrapping issue. - HashTableName + StaticHashTableName - avoid lookup of debug switch when FULLDEBUG is not defined
This commit is contained in:
@ -60,13 +60,13 @@ labelList parseVertices(const string& line)
|
|||||||
DynamicList<label> verts;
|
DynamicList<label> verts;
|
||||||
|
|
||||||
// Assume 'l' is followed by space.
|
// Assume 'l' is followed by space.
|
||||||
label endNum = 1;
|
string::size_type endNum = 1;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
label startNum = line.find_first_not_of(' ', endNum);
|
string::size_type startNum = line.find_first_not_of(' ', endNum);
|
||||||
|
|
||||||
if (startNum == label(string::npos))
|
if (startNum == string::npos)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ labelList parseVertices(const string& line)
|
|||||||
endNum = line.find(' ', startNum);
|
endNum = line.find(' ', startNum);
|
||||||
|
|
||||||
string vertexSpec;
|
string vertexSpec;
|
||||||
if (endNum != label(string::npos))
|
if (endNum != string::npos)
|
||||||
{
|
{
|
||||||
vertexSpec = line.substr(startNum, endNum-startNum);
|
vertexSpec = line.substr(startNum, endNum-startNum);
|
||||||
}
|
}
|
||||||
@ -83,10 +83,10 @@ labelList parseVertices(const string& line)
|
|||||||
vertexSpec = line.substr(startNum, line.size() - startNum);
|
vertexSpec = line.substr(startNum, line.size() - startNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
label slashPos = vertexSpec.find('/');
|
string::size_type slashPos = vertexSpec.find('/');
|
||||||
|
|
||||||
label vertI = 0;
|
label vertI = 0;
|
||||||
if (slashPos != label(string::npos))
|
if (slashPos != string::npos)
|
||||||
{
|
{
|
||||||
IStringStream intStream(vertexSpec.substr(0, slashPos));
|
IStringStream intStream(vertexSpec.substr(0, slashPos));
|
||||||
|
|
||||||
|
|||||||
@ -688,7 +688,6 @@ DebugSwitches
|
|||||||
steadyState 0;
|
steadyState 0;
|
||||||
stl 0;
|
stl 0;
|
||||||
stochasticDispersionRAS 0;
|
stochasticDispersionRAS 0;
|
||||||
string 0;
|
|
||||||
supersonicFreestream 0;
|
supersonicFreestream 0;
|
||||||
surfaceFeatures 0;
|
surfaceFeatures 0;
|
||||||
surfaceInterpolation 0;
|
surfaceInterpolation 0;
|
||||||
|
|||||||
@ -217,7 +217,7 @@ void error::printStack(Ostream& os)
|
|||||||
string::size_type lPos = msg.find('[');
|
string::size_type lPos = msg.find('[');
|
||||||
string::size_type rPos = msg.find(']');
|
string::size_type rPos = msg.find(']');
|
||||||
|
|
||||||
if (lPos != string::npos && rPos != string::npos && lPos<rPos)
|
if (lPos != string::npos && rPos != string::npos && lPos < rPos)
|
||||||
{
|
{
|
||||||
address = msg.substr(lPos+1, rPos-lPos-1);
|
address = msg.substr(lPos+1, rPos-lPos-1);
|
||||||
msg = msg.substr(0, lPos);
|
msg = msg.substr(0, lPos);
|
||||||
@ -232,7 +232,7 @@ void error::printStack(Ostream& os)
|
|||||||
// not an absolute path
|
// not an absolute path
|
||||||
if (programFile[0] != '/')
|
if (programFile[0] != '/')
|
||||||
{
|
{
|
||||||
string tmp = pOpen("which "+programFile);
|
string tmp = pOpen("which " + programFile);
|
||||||
if (tmp[0] == '/' || tmp[0] == '~')
|
if (tmp[0] == '/' || tmp[0] == '~')
|
||||||
{
|
{
|
||||||
programFile = tmp;
|
programFile = tmp;
|
||||||
@ -243,13 +243,13 @@ void error::printStack(Ostream& os)
|
|||||||
|
|
||||||
string::size_type bracketPos = msg.find('(');
|
string::size_type bracketPos = msg.find('(');
|
||||||
|
|
||||||
if (bracketPos != string::size_type(string::npos))
|
if (bracketPos != string::npos)
|
||||||
{
|
{
|
||||||
string::size_type start = bracketPos+1;
|
string::size_type start = bracketPos+1;
|
||||||
|
|
||||||
string::size_type plusPos = msg.find('+', start);
|
string::size_type plusPos = msg.find('+', start);
|
||||||
|
|
||||||
if (plusPos != string::size_type(string::npos))
|
if (plusPos != string::npos)
|
||||||
{
|
{
|
||||||
string cName(msg.substr(start, plusPos-start));
|
string cName(msg.substr(start, plusPos-start));
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ void error::printStack(Ostream& os)
|
|||||||
{
|
{
|
||||||
string::size_type endBracketPos = msg.find(')', start);
|
string::size_type endBracketPos = msg.find(')', start);
|
||||||
|
|
||||||
if (endBracketPos != string::size_type(string::npos))
|
if (endBracketPos != string::npos)
|
||||||
{
|
{
|
||||||
string fullName(msg.substr(start, endBracketPos-start));
|
string fullName(msg.substr(start, endBracketPos-start));
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,10 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef FULLDEBUG
|
||||||
defineTypeNameAndDebug(Foam::HashTableName, 0);
|
defineTypeNameAndDebug(Foam::HashTableName, 0);
|
||||||
|
#else
|
||||||
|
defineTypeName(Foam::HashTableName);
|
||||||
|
int Foam::HashTableName::debug(0);
|
||||||
|
#endif
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -28,6 +28,11 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef FULLDEBUG
|
||||||
defineTypeNameAndDebug(Foam::StaticHashTableName, 0);
|
defineTypeNameAndDebug(Foam::StaticHashTableName, 0);
|
||||||
|
#else
|
||||||
|
defineTypeName(Foam::StaticHashTableName);
|
||||||
|
int Foam::StaticHashTableName::debug(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Macro definitions for declaring ClassName()
|
Macro definitions for declaring ClassName(), NamespaceName(), etc.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -35,6 +35,164 @@ Description
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// declarations (without debug information)
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
//- Add typeName information from argument @a TypeNameString to a class.
|
||||||
|
// Without debug information
|
||||||
|
#define ClassNameNoDebug(TypeNameString) \
|
||||||
|
static const char* typeName_() { return TypeNameString; } \
|
||||||
|
static const ::Foam::word typeName;
|
||||||
|
|
||||||
|
//- Add typeName information from argument @a TypeNameString to a namespace.
|
||||||
|
// Without debug information.
|
||||||
|
#define NamespaceNameNoDebug(TypeNameString) \
|
||||||
|
inline const char* typeName_() { return TypeNameString; } \
|
||||||
|
extern const ::Foam::word typeName;
|
||||||
|
|
||||||
|
//- Add typeName information from argument @a TypeNameString to a template class.
|
||||||
|
// Without debug information.
|
||||||
|
#define TemplateNameNoDebug(TemplateNameString) \
|
||||||
|
class TemplateNameString##Name \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
TemplateNameString##Name() {} \
|
||||||
|
ClassNameNoDebug(#TemplateNameString); \
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// declarations (with debug information)
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
//- Add typeName information from argument @a TypeNameString to a class.
|
||||||
|
// Also declares debug information.
|
||||||
|
#define ClassName(TypeNameString) \
|
||||||
|
ClassNameNoDebug(TypeNameString); \
|
||||||
|
static int debug
|
||||||
|
|
||||||
|
//- Add typeName information from argument @a TypeNameString to a namespace.
|
||||||
|
// Also declares debug information.
|
||||||
|
#define NamespaceName(TypeNameString) \
|
||||||
|
NamespaceNameNoDebug(TypeNameString); \
|
||||||
|
extern int debug
|
||||||
|
|
||||||
|
//- Add typeName information from argument @a TypeNameString to a template class.
|
||||||
|
// Also declares debug information.
|
||||||
|
#define TemplateName(TemplateNameString) \
|
||||||
|
class TemplateNameString##Name \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
TemplateNameString##Name() {} \
|
||||||
|
ClassName(#TemplateNameString); \
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// definitions (without debug information)
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
//- Define the typeName, with alternative lookup as @a Name
|
||||||
|
#define defineTypeNameWithName(Type, Name) \
|
||||||
|
const ::Foam::word Type::typeName(Name);
|
||||||
|
|
||||||
|
//- Define the typeName
|
||||||
|
#define defineTypeName(Type) \
|
||||||
|
defineTypeNameWithName(Type, Type::typeName_());
|
||||||
|
|
||||||
|
#ifdef __INTEL_COMPILER
|
||||||
|
//- Define the typeName as @a Name for template classes
|
||||||
|
# define defineTemplateTypeNameWithName(Type, Name) \
|
||||||
|
defineTypeNameWithName(Type, Name);
|
||||||
|
#else
|
||||||
|
//- Define the typeName as @a Name for template classes
|
||||||
|
# define defineTemplateTypeNameWithName(Type, Name) \
|
||||||
|
template<> \
|
||||||
|
defineTypeNameWithName(Type, Name);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//- Define the typeName for template classes, useful with typedefs
|
||||||
|
#define defineTemplateTypeName(Type) \
|
||||||
|
defineTemplateTypeNameWithName(Type, #Type);
|
||||||
|
|
||||||
|
//- Define the typeName directly for template classes
|
||||||
|
#define defineNamedTemplateTypeName(Type) \
|
||||||
|
defineTemplateTypeNameWithName(Type, Type::typeName_());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// definitions (debug information only)
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
//- Define the debug information, lookup as @a Name
|
||||||
|
#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||||
|
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch));
|
||||||
|
|
||||||
|
//- Define the debug information
|
||||||
|
#define defineDebugSwitch(Type, DebugSwitch) \
|
||||||
|
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch);
|
||||||
|
|
||||||
|
#ifdef __INTEL_COMPILER
|
||||||
|
//- Define the debug information for templates, lookup as @a Name
|
||||||
|
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||||
|
defineDebugSwitchWithName(Type, Name, DebugSwitch);
|
||||||
|
#else
|
||||||
|
//- Define the debug information for templates, lookup as @a Name
|
||||||
|
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||||
|
template<> \
|
||||||
|
defineDebugSwitchWithName(Type, Name, DebugSwitch);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//- Define the debug information for templates
|
||||||
|
// Useful with typedefs
|
||||||
|
#define defineTemplateDebugSwitch(Type, DebugSwitch) \
|
||||||
|
defineTemplateDebugSwitchWithName(Type, #Type, DebugSwitch);
|
||||||
|
|
||||||
|
//- Define the debug information directly for templates
|
||||||
|
#define defineNamedTemplateDebugSwitch(Type, DebugSwitch) \
|
||||||
|
defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// definitions (with debug information)
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
//- Define the typeName and debug information
|
||||||
|
#define defineTypeNameAndDebug(Type, DebugSwitch) \
|
||||||
|
defineTypeName(Type); \
|
||||||
|
defineDebugSwitch(Type, DebugSwitch);
|
||||||
|
|
||||||
|
//- Define the typeName and debug information, lookup as @a Name
|
||||||
|
#define defineTemplateTypeNameAndDebugWithName(Type, Name, DebugSwitch) \
|
||||||
|
defineTemplateTypeNameWithName(Type, Name); \
|
||||||
|
defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch);
|
||||||
|
|
||||||
|
//- Define the typeName and debug information for templates, useful with typedefs
|
||||||
|
#define defineTemplateTypeNameAndDebug(Type, DebugSwitch) \
|
||||||
|
defineTemplateTypeNameAndDebugWithName(Type, #Type, DebugSwitch);
|
||||||
|
|
||||||
|
//- Define the typeName and debug information for templates
|
||||||
|
#define defineNamedTemplateTypeNameAndDebug(Type, DebugSwitch) \
|
||||||
|
defineNamedTemplateTypeName(Type); \
|
||||||
|
defineNamedTemplateDebugSwitch(Type, DebugSwitch);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
#if 0 // PREVIOUS DEFINITIONS
|
||||||
|
|
||||||
//- Adds typeName information from its argument @a TypeNameString to a class
|
//- Adds typeName information from its argument @a TypeNameString to a class
|
||||||
#define ClassName(TypeNameString) \
|
#define ClassName(TypeNameString) \
|
||||||
static const char* typeName_() { return TypeNameString; } \
|
static const char* typeName_() { return TypeNameString; } \
|
||||||
@ -89,6 +247,8 @@ public: \
|
|||||||
int Type::debug(::Foam::debug::debugSwitch(Type::typeName_(), DebugSwitch));
|
int Type::debug(::Foam::debug::debugSwitch(Type::typeName_(), DebugSwitch));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // OLD DEFINITIONS
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -60,16 +60,22 @@ Description
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
// declarations for use in header files
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
#define TypeNameNoDebug(TypeNameString) \
|
||||||
|
ClassNameNoDebug(TypeNameString); \
|
||||||
|
virtual const word& type() const { return typeName; }
|
||||||
|
|
||||||
#define TypeName(TypeNameString) \
|
#define TypeName(TypeNameString) \
|
||||||
ClassName(TypeNameString); \
|
ClassName(TypeNameString); \
|
||||||
virtual const word& type() const { return typeName; }
|
virtual const word& type() const { return typeName; }
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Reference type cast template function wraps dynamic_cast to handle the
|
// Reference type cast template function wraps dynamic_cast to handle the
|
||||||
|
|||||||
@ -25,13 +25,10 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "string.H"
|
#include "string.H"
|
||||||
#include "debug.H"
|
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||||
|
|
||||||
const char* const Foam::string::typeName = "string";
|
|
||||||
int Foam::string::debug(debug::debugSwitch(string::typeName, 0));
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -80,8 +80,6 @@ public:
|
|||||||
|
|
||||||
// Static data members
|
// Static data members
|
||||||
|
|
||||||
static const char* const typeName;
|
|
||||||
static int debug;
|
|
||||||
static const string null;
|
static const string null;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -138,7 +138,7 @@ bool Foam::fileFormats::OBJsurfaceFormat<Face>::read
|
|||||||
string::size_type startNum =
|
string::size_type startNum =
|
||||||
line.find_first_not_of(' ', endNum);
|
line.find_first_not_of(' ', endNum);
|
||||||
|
|
||||||
if (startNum == string::size_type(string::npos))
|
if (startNum == string::npos)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ bool Foam::fileFormats::OBJsurfaceFormat<Face>::read
|
|||||||
endNum = line.find(' ', startNum);
|
endNum = line.find(' ', startNum);
|
||||||
|
|
||||||
string vertexSpec;
|
string vertexSpec;
|
||||||
if (endNum != string::size_type(string::npos))
|
if (endNum != string::npos)
|
||||||
{
|
{
|
||||||
vertexSpec = line.substr(startNum, endNum-startNum);
|
vertexSpec = line.substr(startNum, endNum-startNum);
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ bool Foam::fileFormats::OBJsurfaceFormat<Face>::read
|
|||||||
string::size_type slashPos = vertexSpec.find('/');
|
string::size_type slashPos = vertexSpec.find('/');
|
||||||
|
|
||||||
label vertI = 0;
|
label vertI = 0;
|
||||||
if (slashPos != string::size_type(string::npos))
|
if (slashPos != string::npos)
|
||||||
{
|
{
|
||||||
IStringStream intStream(vertexSpec.substr(0, slashPos));
|
IStringStream intStream(vertexSpec.substr(0, slashPos));
|
||||||
|
|
||||||
|
|||||||
@ -62,13 +62,12 @@ static bool readCmd(IFstream& ACfile, string& cmd, string& args)
|
|||||||
string line;
|
string line;
|
||||||
ACfile.getLine(line);
|
ACfile.getLine(line);
|
||||||
|
|
||||||
label spaceIndex = line.find(' ');
|
string::size_type space = line.find(' ');
|
||||||
|
|
||||||
if (spaceIndex != label(string::npos))
|
if (space != string::npos)
|
||||||
{
|
{
|
||||||
cmd = line.substr(0, spaceIndex);
|
cmd = line.substr(0, space);
|
||||||
|
args = line.substr(space+1);
|
||||||
args = line.substr(spaceIndex+1);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -91,18 +90,14 @@ static bool readUpto
|
|||||||
string line;
|
string line;
|
||||||
ACfile.getLine(line);
|
ACfile.getLine(line);
|
||||||
|
|
||||||
label spaceIndex = line.find(' ');
|
string::size_type space = line.find(' ');
|
||||||
|
|
||||||
if (spaceIndex != label(string::npos))
|
if (space != string::npos && line.substr(0, space) == cmd)
|
||||||
{
|
{
|
||||||
if (line.substr(0, spaceIndex) == cmd)
|
args = line.substr(space+1);
|
||||||
{
|
|
||||||
args = line.substr(spaceIndex+1);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -105,13 +105,14 @@ bool triSurface::readOBJ(const fileName& OBJfileName)
|
|||||||
DynamicList<label> verts;
|
DynamicList<label> verts;
|
||||||
|
|
||||||
// Assume 'f' is followed by space.
|
// Assume 'f' is followed by space.
|
||||||
size_type endNum = 1;
|
string::size_type endNum = 1;
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
size_type startNum = line.find_first_not_of(' ', endNum);
|
string::size_type startNum =
|
||||||
|
line.find_first_not_of(' ', endNum);
|
||||||
|
|
||||||
if (startNum == size_type(string::npos))
|
if (startNum == string::npos)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -119,7 +120,7 @@ bool triSurface::readOBJ(const fileName& OBJfileName)
|
|||||||
endNum = line.find(' ', startNum);
|
endNum = line.find(' ', startNum);
|
||||||
|
|
||||||
string vertexSpec;
|
string vertexSpec;
|
||||||
if (endNum != size_type(string::npos))
|
if (endNum != string::npos)
|
||||||
{
|
{
|
||||||
vertexSpec = line.substr(startNum, endNum-startNum);
|
vertexSpec = line.substr(startNum, endNum-startNum);
|
||||||
}
|
}
|
||||||
@ -128,10 +129,10 @@ bool triSurface::readOBJ(const fileName& OBJfileName)
|
|||||||
vertexSpec = line.substr(startNum, line.size() - startNum);
|
vertexSpec = line.substr(startNum, line.size() - startNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_type slashPos = vertexSpec.find('/');
|
string::size_type slashPos = vertexSpec.find('/');
|
||||||
|
|
||||||
label vertI = 0;
|
label vertI = 0;
|
||||||
if (slashPos != size_type(string::npos))
|
if (slashPos != string::npos)
|
||||||
{
|
{
|
||||||
IStringStream intStream(vertexSpec.substr(0, slashPos));
|
IStringStream intStream(vertexSpec.substr(0, slashPos));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user