Changed: Use std::string instead of const char*

--HG--
branch : develop
This commit is contained in:
kervala 2016-12-19 13:33:24 +01:00
parent 0a4ce7e4e1
commit 6978dc9bee
10 changed files with 44 additions and 44 deletions

View file

@ -382,7 +382,7 @@ void scanFiles(const CSString &filespec)
UFormElm *fieldForm=NULL;
std::string valueString;
form->getRootNode ().getNodeByName(&fieldForm, fields[i]._name.c_str());
form->getRootNode ().getNodeByName(&fieldForm, fields[i]._name);
if (fieldForm)
{
@ -1026,7 +1026,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
const UFormElm *fieldForm=NULL;
if (rootForm.getNodeByName(&fieldForm, var.c_str()))
if (rootForm.getNodeByName(&fieldForm, var))
{
UFormDfn *dfnForm=const_cast<UFormElm&>(rootForm).getStructDfn();
nlassert(dfnForm);

View file

@ -541,7 +541,7 @@ void CAnimationSetSheet::build(const NLGEORGES::UFormElm &rootElmt)
nlinfo("%2d state '%s' :", i, stateName.c_str());
const UFormElm *elmt = 0;
if(rootElmt.getNodeByName(&elmt, stateName.c_str()))
if(rootElmt.getNodeByName(&elmt, stateName))
{
bool animPresent = false;
if(elmt)

View file

@ -62,7 +62,7 @@ void CMissionSheet::build(const NLGEORGES::UFormElm &item)
{
const UFormElm * stepStruct;
string varName = string("step") + NLMISC::toString(i);
item.getNodeByName (&stepStruct, varName.c_str());
item.getNodeByName (&stepStruct, varName);
if (stepStruct)
{

View file

@ -235,7 +235,7 @@ CActionString::CActionString (IAction::TTypeAction type, const std::string &newV
bool vdfnArray;
CForm *form=doc.getFormPtr ();
CFormElm *elm = doc.getRootNode (slot);
nlverify ( elm->getNodeByName (_FormName.c_str (), &parentDfn, indexDfn,
nlverify ( elm->getNodeByName (_FormName, &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, vdfnArray, true, NLGEORGES_FIRST_ROUND) );
if (node)
{
@ -364,7 +364,7 @@ bool CActionString::doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, b
bool parentVDnfArray;
CForm *form=doc.getFormPtr ();
CFormElm *elm = doc.getRootNode (_Slot);
nlverify ( elm->getNodeByName (_FormName.c_str (), &parentDfn, indexDfn,
nlverify ( elm->getNodeByName (_FormName, &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, parentVDnfArray, true, NLGEORGES_FIRST_ROUND) );
nlassert (node);
CFormElmAtom *atom = safe_cast<CFormElmAtom*> (node);
@ -437,14 +437,14 @@ bool CActionString::doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, b
bool vdfnArray;
CForm *form=doc.getFormPtr ();
CFormElm *elm = doc.getRootNode (_Slot);
nlverify ( elm->getNodeByName (_FormName.c_str (), &parentDfn, indexDfn,
nlverify ( elm->getNodeByName (_FormName, &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, vdfnArray, true, NLGEORGES_FIRST_ROUND) );
if (node)
{
CFormElmArray* array = safe_cast<CFormElmArray*> (node->getParent ());
array->Elements[idInParent].Name = _Value[index];
modified = true;
update (true, DoNothing, doc, _FormName.c_str ());
update (true, DoNothing, doc, _FormName);
}
}
break;
@ -716,14 +716,14 @@ bool CActionStringVector::doAction (CGeorgesEditDoc &doc, bool redo, bool &modif
bool parentVDfnArray;
CForm *form=doc.getFormPtr ();
CFormElm *elm = doc.getRootNode (slot);
nlverify ( elm->getNodeByName (_FormName.c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true) );
nlverify ( elm->getNodeByName (_FormName, &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true) );
// Is a type entry ?
if ((type == UFormDfn::EntryType) && array)
{
// Create the array
bool created;
nlverify ( elm->createNodeByName (_FormName.c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, created) );
nlverify ( elm->createNodeByName (_FormName, &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, created) );
nlassert (node);
// Get the atom
@ -921,7 +921,7 @@ bool CActionStringVectorVector::doAction (CGeorgesEditDoc &doc, bool redo, bool
// ***************************************************************************
CActionBuffer::CActionBuffer (IAction::TTypeAction type, const uint8 *buffer, uint bufferSize, CGeorgesEditDoc &doc, const char *formName, const char *userData, uint selId, uint slot) : IAction (type, selId, slot)
CActionBuffer::CActionBuffer(IAction::TTypeAction type, const uint8 *buffer, uint bufferSize, CGeorgesEditDoc &doc, const std::string &formName, const std::string &userData, uint selId, uint slot) : IAction(type, selId, slot)
{
// New value
_FormName = formName;

View file

@ -548,7 +548,7 @@ void CFormDialog::setToDocument (uint widget)
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (Widgets[widget]->getSlot ());
nlverify ( elm->getNodeByName (Widgets[widget]->getFormName ().c_str (), &parentDfn, indexDfn,
nlverify ( elm->getNodeByName (Widgets[widget]->getFormName (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Must create array or virtual dfn ?
@ -811,7 +811,7 @@ BOOL CFormDialog::OnCommand(WPARAM wParam, LPARAM lParam)
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (Widgets[widgetId]->getSlot ());
nlverify ( elm->getNodeByName (Widgets[widgetId]->getFormName ().c_str (), &parentDfn, indexDfn,
nlverify ( elm->getNodeByName (Widgets[widgetId]->getFormName (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
nlassert (parentDfn);
@ -943,7 +943,7 @@ BOOL CFormDialog::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
// Search for the node
nlverify ((const CFormElm*)(doc->getRootNode (Widgets[i]->getSlot ()))->getNodeByName
(Widgets[i]->getFormName ().c_str (), &parentDfn, lastElement, &nodeDfn, &nodeType,
(Widgets[i]->getFormName (), &parentDfn, lastElement, &nodeDfn, &nodeType,
&node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND));
// Todo: multiply here by the spinner precision
@ -1097,7 +1097,7 @@ void CFormDialog::getFromDocument ()
UFormDfn::TEntryType type;
// Search for the node
nlverify (((const CFormElm*)(doc->getRootNode (subObject->getSlot ())))->getNodeByName (subObject->getFormName ().c_str (), &parentDfn, lastElement, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND));
nlverify (((const CFormElm*)(doc->getRootNode (subObject->getSlot ())))->getNodeByName (subObject->getFormName (), &parentDfn, lastElement, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND));
// Should have a parent DFN, else it is the root element
if (parentDfn)
@ -1342,7 +1342,7 @@ void IFormWidget::updateLabel ()
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (getSlot ());
nlverify ( elm->getNodeByName (FormName.c_str (), &parentDfn, indexDfn,
nlverify ( elm->getNodeByName (FormName, &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Does the node exist ?
@ -1401,7 +1401,7 @@ bool IFormWidget::getNode (const CFormDfn **parentDfn, uint &lastElement, const
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (getSlot ());
return (elm->getNodeByName (FormName.c_str (), parentDfn,
return (elm->getNodeByName (FormName, parentDfn,
lastElement, nodeDfn, nodeType, node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
}
return false;
@ -1558,7 +1558,7 @@ void CFormMemCombo::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent,
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (getSlot ());
nlverify ( elm->getNodeByName (FormName.c_str (), &parentDfn, indexDfn,
nlverify ( elm->getNodeByName (FormName, &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
FirstId = dialog_index;
@ -1710,7 +1710,7 @@ void CFormMemCombo::getFromDocument (CForm &form)
UFormDfn::TEntryType type;
bool array;
bool parentVDfnArray;
nlverify (((const CFormElm*)doc->getRootNode(getSlot ()))->getNodeByName (FormName.c_str(), &parentDfn, lastElement, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND));
nlverify (((const CFormElm*)doc->getRootNode(getSlot ()))->getNodeByName (FormName, &parentDfn, lastElement, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND));
nlassert (array);
// Node exist ?
@ -1743,7 +1743,7 @@ void CFormMemCombo::getFromDocument (CForm &form)
UFormDfn::TEntryType type;
bool array;
bool parentVDfnArray;
nlverify (((const CFormElm*)doc->getRootNode (getSlot ()))->getNodeByName (FormName.c_str(), &parentDfn, lastElement, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND));
nlverify (((const CFormElm*)doc->getRootNode (getSlot ()))->getNodeByName (FormName, &parentDfn, lastElement, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND));
nlassert (!array);
// Node exist ?

View file

@ -1025,7 +1025,7 @@ void CGeorgesEditApp::OnUpdateFileSaveAll(CCmdUI* pCmdUI)
pCmdUI->Enable (getActiveDocument () != NULL);
}
bool CGeorgesEditApp::SerialIntoMemStream (const char *formName, CGeorgesEditDoc *doc, uint slot, bool copyToClipboard)
bool CGeorgesEditApp::SerialIntoMemStream (const std::string &formName, CGeorgesEditDoc *doc, uint slot, bool copyToClipboard)
{
// Ok, get the node
const CFormDfn *parentDfn;
@ -1228,7 +1228,7 @@ bool CGeorgesEditApp::FillMemStreamWithClipboard (const char *formName, CGeorges
return false;
}
bool CGeorgesEditApp::SerialFromMemStream (const char *formName, CGeorgesEditDoc *doc, uint slot)
bool CGeorgesEditApp::SerialFromMemStream (const std::string &formName, CGeorgesEditDoc *doc, uint slot)
{
// The form pointer
CForm *form = doc->getFormPtr ();

View file

@ -119,11 +119,11 @@ public:
public:
// Memory stream
NLMISC::CMemStream MemStream;
bool FillMemStreamWithClipboard (const char *formName, CGeorgesEditDoc *doc, uint slot);
bool FillMemStreamWithClipboard (const std::string &formName, CGeorgesEditDoc *doc, uint slot);
void FillMemStreamWithBuffer (const uint8 *buffer, uint size);
bool SerialIntoMemStream (const char *formName, CGeorgesEditDoc *doc, uint slot, bool copyToClipboard);
bool SerialFromMemStream (const char *formName, CGeorgesEditDoc *doc, uint slot);
bool SerialIntoMemStream (const std::string &formName, CGeorgesEditDoc *doc, uint slot, bool copyToClipboard);
bool SerialFromMemStream (const std::string &formName, CGeorgesEditDoc *doc, uint slot);
// Init
BOOL initInstance (int nCmdShow, bool exeStandalone, int x, int y, int cx, int cy);
@ -136,7 +136,7 @@ public:
// From IEdit
NLGEORGES::IEditDocument *getActiveDocument ();
NLGEORGES::IEditDocument *createDocument (const char *dfnName, const char *pathName);
NLGEORGES::IEditDocument *createDocument (const std::string &dfnName, const std::string &pathName);
virtual void getSearchPath (std::string &searchPath);
virtual NLMISC::CConfigFile &getConfigFile() { return ConfigFile; }
@ -153,10 +153,10 @@ public:
CImageListEx ImageList;
// Get a template form
CMultiDocTemplate *getFormDocTemplate (const char *dfnName);
CMultiDocTemplate *getFormDocTemplate (const std::string &dfnName);
void saveWindowState (const CWnd *wnd, const char *name, bool controlBar);
void loadWindowState (CWnd *wnd, const char *name, bool changeShowWindow, bool controlBar);
void saveWindowState (const CWnd *wnd, const std::string &name, bool controlBar);
void loadWindowState (CWnd *wnd, const std::string &name, bool changeShowWindow, bool controlBar);
// Overrides
// ClassWizard generated virtual function overrides
@ -176,8 +176,8 @@ public:
void releasePlugins ();
// Dialog function
void outputError (const char* message);
bool yesNo (const char* message);
void outputError (const std::string &message);
bool yesNo (const std::string &message);
bool getColor (NLMISC::CRGBA &color);
// Browse an URL

View file

@ -355,7 +355,7 @@ CGeorgesEditDocSub *CGeorgesEditDoc::addStruct (CGeorgesEditDocSub *parent, CFor
{
// Get the node by name
UFormElm *uNode;
if (formPtr->getParent (parent)->getRootNode ().getNodeByName (&uNode, entryName.c_str(), NULL, false) && uNode)
if (formPtr->getParent (parent)->getRootNode ().getNodeByName (&uNode, entryName, NULL, false) && uNode)
{
nextArray = safe_cast<CFormElmArray*> (uNode);
}
@ -382,7 +382,7 @@ CGeorgesEditDocSub *CGeorgesEditDoc::addStruct (CGeorgesEditDocSub *parent, CFor
{
// Get the node by name
UFormElm *uNode;
if (formPtr->getParent (parent)->getRootNode ().getNodeByName (&uNode, entryName.c_str(), NULL, false) && uNode)
if (formPtr->getParent (parent)->getRootNode ().getNodeByName (&uNode, entryName, NULL, false) && uNode)
{
nextForm = safe_cast<CFormElmStruct*> (uNode);
}
@ -414,7 +414,7 @@ CGeorgesEditDocSub *CGeorgesEditDoc::addStruct (CGeorgesEditDocSub *parent, CFor
{
// Get the node by name
UFormElm *uNode;
if (formPtr->getParent (parent)->getRootNode ().getNodeByName (&uNode, entryName.c_str(), NULL, false) && uNode)
if (formPtr->getParent (parent)->getRootNode ().getNodeByName (&uNode, entryName, NULL, false) && uNode)
{
nextArray = safe_cast<CFormElmArray*> (uNode);
}
@ -1546,7 +1546,7 @@ int CGeorgesEditDocSub::getItemImage (CGeorgesEditDoc *doc) const
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (getSlot ());
nlverify ( elm->getNodeByName (getFormName ().c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
nlverify ( elm->getNodeByName (getFormName (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
if (array)
{

View file

@ -248,7 +248,7 @@ void CGeorgesImpl::PutGroupText (const std::vector<std::string>& _vText, bool ap
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (subDoc->getSlot ());
nlverify ( elm->getNodeByName (subDoc->getFormName ().c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
nlverify ( elm->getNodeByName (subDoc->getFormName (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Is a type entry ?
if ((type == UFormDfn::EntryType) && array)
@ -314,7 +314,7 @@ void CGeorgesImpl::PutText (const std::string& _sText)
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (subDoc->getSlot ());
nlverify ( elm->getNodeByName (subDoc->getFormName ().c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
nlverify ( elm->getNodeByName (subDoc->getFormName (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// It is an array ?
if (array&&(type == UFormDfn::EntryType))
@ -374,7 +374,7 @@ void CGeorgesImpl::LineUp ()
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (subDoc->getSlot ());
nlverify ( elm->getNodeByName (subDoc->getFormName ().c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
nlverify ( elm->getNodeByName (subDoc->getFormName (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Is a type entry ?
if ( (type == UFormDfn::EntryType) && !array )
@ -417,7 +417,7 @@ void CGeorgesImpl::LineDown ()
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (subDoc->getSlot ());
nlverify ( elm->getNodeByName (subDoc->getFormName ().c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
nlverify ( elm->getNodeByName (subDoc->getFormName (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Is a type entry ?
if ( (type == UFormDfn::EntryType) && !array )

View file

@ -289,7 +289,7 @@ BOOL CLeftView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = (CFormElm *)doc->getRootNode (subObject->getSlot ());
nlverify ( elm->getNodeByName (parent->getFormName ().c_str (), &parentDfn, indexDfn,
nlverify ( elm->getNodeByName (parent->getFormName (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &parentNode, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Is a non empty array ?
@ -343,7 +343,7 @@ BOOL CLeftView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = (CFormElm *)doc->getRootNode (subObject->getSlot ());
nlverify ( elm->getNodeByName (parent->getFormName ().c_str (), &parentDfn, indexDfn,
nlverify ( elm->getNodeByName (parent->getFormName (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &parentNode, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Is a non empty array ?
@ -430,7 +430,7 @@ BOOL CLeftView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = (CFormElm *)doc->getRootNode (subObject->getSlot ());
nlverify ( elm->getNodeByName (parent->getFormName ().c_str (), &parentDfn, indexDfn,
nlverify ( elm->getNodeByName (parent->getFormName (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Is the parent array ?
@ -849,7 +849,7 @@ void CLeftView::OnInsert()
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = (CFormElm *)doc->getRootNode (subObject->getSlot ());
nlverify ( elm->getNodeByName (parent->getFormName ().c_str (), &parentDfn, indexDfn,
nlverify ( elm->getNodeByName (parent->getFormName (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &parentNode, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Is a non empty array ?
@ -911,7 +911,7 @@ void CLeftView::OnDelete()
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = (CFormElm *)doc->getRootNode (subObject->getSlot ());
nlverify ( elm->getNodeByName (parent->getFormName ().c_str (), &parentDfn, indexDfn,
nlverify ( elm->getNodeByName (parent->getFormName (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &parentNode, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Is a non empty array ?