Browse Source

Better padding string generation

Michael Hansen 11 years ago
parent
commit
281f95638d
  1. 18
      Sources/Plasma/PubUtilLib/plSDL/plStateDataRecord.cpp
  2. 21
      Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp

18
Sources/Plasma/PubUtilLib/plSDL/plStateDataRecord.cpp

@ -736,10 +736,7 @@ void plStateDataRecord::DumpToObjectDebugger(const char* msg, bool dirtyOnly, in
if (!dbg) if (!dbg)
return; return;
plString pad; plString pad = plString::Fill(level * 3, ' ');
int i;
for(i=0;i<level; i++)
pad += " ";
int numVars = dirtyOnly ? GetNumDirtyVars() : GetNumUsedVars(); int numVars = dirtyOnly ? GetNumDirtyVars() : GetNumUsedVars();
int numSDVars = dirtyOnly ? GetNumDirtySDVars() : GetNumUsedSDVars(); int numSDVars = dirtyOnly ? GetNumDirtySDVars() : GetNumUsedSDVars();
@ -752,7 +749,7 @@ void plStateDataRecord::DumpToObjectDebugger(const char* msg, bool dirtyOnly, in
pad.c_str(), this, fDescriptor->GetName().c_str(), dirtyOnly, numVars+numSDVars, fFlags&kVolatile).c_str()); pad.c_str(), this, fDescriptor->GetName().c_str(), dirtyOnly, numVars+numSDVars, fFlags&kVolatile).c_str());
// dump simple vars // dump simple vars
for(i=0;i<fVarsList.size(); i++) for (size_t i=0; i<fVarsList.size(); i++)
{ {
if ( (dirtyOnly && fVarsList[i]->IsDirty()) || (!dirtyOnly && fVarsList[i]->IsUsed()) ) if ( (dirtyOnly && fVarsList[i]->IsDirty()) || (!dirtyOnly && fVarsList[i]->IsUsed()) )
{ {
@ -761,7 +758,7 @@ void plStateDataRecord::DumpToObjectDebugger(const char* msg, bool dirtyOnly, in
} }
// dump nested vars // dump nested vars
for(i=0;i<fSDVarsList.size(); i++) for (size_t i=0; i<fSDVarsList.size(); i++)
{ {
if ( (dirtyOnly && fSDVarsList[i]->IsDirty()) || (!dirtyOnly && fSDVarsList[i]->IsUsed()) ) if ( (dirtyOnly && fSDVarsList[i]->IsDirty()) || (!dirtyOnly && fSDVarsList[i]->IsUsed()) )
{ {
@ -772,10 +769,7 @@ void plStateDataRecord::DumpToObjectDebugger(const char* msg, bool dirtyOnly, in
void plStateDataRecord::DumpToStream(hsStream* stream, const char* msg, bool dirtyOnly, int level) const void plStateDataRecord::DumpToStream(hsStream* stream, const char* msg, bool dirtyOnly, int level) const
{ {
std::string pad; plString pad = plString::Fill(level * 3, ' ');
int i;
for(i=0;i<level; i++)
pad += " ";
int numVars = dirtyOnly ? GetNumDirtyVars() : GetNumUsedVars(); int numVars = dirtyOnly ? GetNumDirtyVars() : GetNumUsedVars();
int numSDVars = dirtyOnly ? GetNumDirtySDVars() : GetNumUsedSDVars(); int numSDVars = dirtyOnly ? GetNumDirtySDVars() : GetNumUsedSDVars();
@ -794,7 +788,7 @@ void plStateDataRecord::DumpToStream(hsStream* stream, const char* msg, bool dir
stream->Write(logStr.GetSize(), logStr.c_str()); stream->Write(logStr.GetSize(), logStr.c_str());
// dump simple vars // dump simple vars
for(i=0;i<fVarsList.size(); i++) for (size_t i=0; i<fVarsList.size(); i++)
{ {
if ( (dirtyOnly && fVarsList[i]->IsDirty()) || (!dirtyOnly && fVarsList[i]->IsUsed()) ) if ( (dirtyOnly && fVarsList[i]->IsDirty()) || (!dirtyOnly && fVarsList[i]->IsUsed()) )
{ {
@ -803,7 +797,7 @@ void plStateDataRecord::DumpToStream(hsStream* stream, const char* msg, bool dir
} }
// dump nested vars // dump nested vars
for(i=0;i<fSDVarsList.size(); i++) for (size_t i=0; i<fSDVarsList.size(); i++)
{ {
if ( (dirtyOnly && fSDVarsList[i]->IsDirty()) || (!dirtyOnly && fSDVarsList[i]->IsUsed()) ) if ( (dirtyOnly && fSDVarsList[i]->IsDirty()) || (!dirtyOnly && fSDVarsList[i]->IsUsed()) )
{ {

21
Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp

@ -2279,10 +2279,7 @@ void plSimpleStateVariable::DumpToObjectDebugger(bool dirtyOnly, int level) cons
if (!dbg) if (!dbg)
return; return;
plString pad; plString pad = plString::Fill(level * 3, ' ');
int i;
for(i=0;i<level; i++)
pad += " ";
plString logMsg = plFormat("{}SimpleVar, name:{}[{}]", pad, GetName(), GetCount()); plString logMsg = plFormat("{}SimpleVar, name:{}[{}]", pad, GetName(), GetCount());
if (GetCount()>1) if (GetCount()>1)
@ -2292,7 +2289,7 @@ void plSimpleStateVariable::DumpToObjectDebugger(bool dirtyOnly, int level) cons
} }
pad += "\t"; pad += "\t";
for(i=0;i<GetCount(); i++) for (size_t i=0; i<GetCount(); i++)
{ {
plString s=GetAsString(i); plString s=GetAsString(i);
if (fVar.GetAtomicType() == plVarDescriptor::kTime) if (fVar.GetAtomicType() == plVarDescriptor::kTime)
@ -2317,10 +2314,7 @@ void plSimpleStateVariable::DumpToObjectDebugger(bool dirtyOnly, int level) cons
void plSimpleStateVariable::DumpToStream(hsStream* stream, bool dirtyOnly, int level) const void plSimpleStateVariable::DumpToStream(hsStream* stream, bool dirtyOnly, int level) const
{ {
plString pad; plString pad = plString::Fill(level * 3, ' ');
int i;
for(i=0;i<level; i++)
pad += " ";
plString logMsg = plFormat("{}SimpleVar, name:{}[{}]", pad, GetName(), GetCount()); plString logMsg = plFormat("{}SimpleVar, name:{}[{}]", pad, GetName(), GetCount());
if (GetCount()>1) if (GetCount()>1)
@ -2330,7 +2324,7 @@ void plSimpleStateVariable::DumpToStream(hsStream* stream, bool dirtyOnly, int l
} }
pad += "\t"; pad += "\t";
for(i=0;i<GetCount(); i++) for (size_t i=0; i<GetCount(); i++)
{ {
plString s=GetAsString(i); plString s=GetAsString(i);
if (fVar.GetAtomicType() == plVarDescriptor::kTime) if (fVar.GetAtomicType() == plVarDescriptor::kTime)
@ -2676,16 +2670,13 @@ void plSDStateVariable::DumpToObjectDebugger(bool dirtyOnly, int level) const
if (!dbg) if (!dbg)
return; return;
std::string pad; plString pad = plString::Fill(level * 3, ' ');
int i;
for(i=0;i<level; i++)
pad += " ";
int cnt = dirtyOnly ? GetDirtyCount() : GetUsedCount(); int cnt = dirtyOnly ? GetDirtyCount() : GetUsedCount();
dbg->LogMsg(plString::Format( "%sSDVar, name:%s dirtyOnly:%d count:%d", dbg->LogMsg(plString::Format( "%sSDVar, name:%s dirtyOnly:%d count:%d",
pad.c_str(), GetName().c_str(), dirtyOnly, cnt).c_str()); pad.c_str(), GetName().c_str(), dirtyOnly, cnt).c_str());
for(i=0;i<GetCount();i++) for (size_t i=0; i<GetCount(); i++)
{ {
if ( (dirtyOnly && fDataRecList[i]->IsDirty()) || if ( (dirtyOnly && fDataRecList[i]->IsDirty()) ||
(!dirtyOnly && fDataRecList[i]->IsUsed()) ) (!dirtyOnly && fDataRecList[i]->IsUsed()) )

Loading…
Cancel
Save