Enforced consistence of const parameters among all the funcs

This commit is contained in:
Paolo Cignoni 2005-12-02 00:47:15 +00:00
parent 688af7646e
commit 706d22e070
3 changed files with 19 additions and 19 deletions

View File

@ -75,4 +75,4 @@ enum values {VALUE_INTEGER, VALUE_FLOAT, VALUE_BOOL, VALUE_STRING};
//#define INSTANCES_NODE 9; //#define INSTANCES_NODE 9;
//#define INSTANCE_NODE 10; //#define INSTANCE_NODE 10;
#endif #endif

View File

@ -32,7 +32,7 @@ class EntryNode: public Node
public: public:
EntryNode(void){node_type = ENTRY_NODE; type = "empty";}; EntryNode(void){node_type = ENTRY_NODE; type = "empty";};
int node_type; int node_type;
char* type; const char* type;
ValueNode value; ValueNode value;
void addValue(ValueNode vn); void addValue(ValueNode vn);
void setEntry(EntryNode en); void setEntry(EntryNode en);
@ -64,12 +64,12 @@ class OwnSlotNode: public Node
public: public:
OwnSlotNode(void){node_type = OWNSLOT_NODE; name = "empty";}; OwnSlotNode(void){node_type = OWNSLOT_NODE; name = "empty";};
int node_type; int node_type;
char* name; const char* name;
EntryNode entry; EntryNode entry;
virtual void printNode(); virtual void printNode();
virtual int qualifyNode(); virtual int qualifyNode();
void addEntry(EntryNode en); void addEntry(EntryNode en);
void setName(char* s){name = s;}; void setName(const char* s){name = s;};
}; };
void OwnSlotNode::printNode() void OwnSlotNode::printNode()
@ -147,4 +147,4 @@ void SlotsNode::printNode()
} }
int SlotsNode::qualifyNode() int SlotsNode::qualifyNode()
{return node_type;} {return node_type;}

View File

@ -40,22 +40,22 @@ public:
MainNode(void){node_type = MAIN_NODE;}; MainNode(void){node_type = MAIN_NODE;};
int node_type; int node_type;
list<pair<char*,char*> > headers; list<pair<const char*,const char*> > headers;
void addHeaders(char* str, char*val); void addHeaders(const char* str, const char*val);
virtual void printNode(); virtual void printNode();
virtual int qualifyNode(); virtual int qualifyNode();
}; };
void MainNode::addHeaders(char* str, char*val) void MainNode::addHeaders(const char* str, const char*val)
{ {
headers.push_back(pair<char*,char*>(str,val)); headers.push_back(pair<const char*, const char*>(str,val));
} }
void MainNode::printNode() void MainNode::printNode()
{ {
cout<<"MainNode: node_type is "<<node_type<<"\n"; cout<<"MainNode: node_type is "<<node_type<<"\n";
list<pair<char*,char*> >::iterator it; list<pair<const char*,const char*> >::iterator it;
for(it = headers.begin(); it!= headers.end(); ++it) for(it = headers.begin(); it!= headers.end(); ++it)
{ {
cout<<"MainNode: First element is "<< it->first<<"\n"; cout<<"MainNode: First element is "<< it->first<<"\n";
@ -80,13 +80,13 @@ public:
// methods // methods
void initializeMain(); void initializeMain();
void finalizeMain(); void finalizeMain();
void addHeaders(char* str, char*val); void addHeaders(const char* str, const char*val);
void addSlots(SlotNode* sn); void addSlots(SlotNode* sn);
// void addFacets(); // void addFacets();
void addClasses(ClassNode* cn); void addClasses(ClassNode* cn);
void addInstances(InstanceNode* in); void addInstances(InstanceNode* in);
void addNode(char* s, int value_type, char* name); void addNode(const char* s, int value_type, const char* name);
void printXMLTree(); void printXMLTree();
@ -98,7 +98,7 @@ void XMLTree::initializeMain()
MainNode* mn = new MainNode; MainNode* mn = new MainNode;
//NodeGroup* ng = new NodeGroup; //NodeGroup* ng = new NodeGroup;
mn->headers.push_back(pair<char*,char*>("protegekb","")); mn->headers.push_back(pair<const char*,const char*>("protegekb",""));
char* s1 = "http://www.w3.org/2001/XMLSchema-instance"; char* s1 = "http://www.w3.org/2001/XMLSchema-instance";
char* s2 = new(char[25]); char* s2 = new(char[25]);
@ -136,16 +136,16 @@ void XMLTree::finalizeMain()
addInstances(in); addInstances(in);
MainNode* mn = new MainNode; MainNode* mn = new MainNode;
mn->headers.push_back(pair<char*,char*>("/",XML_SCHEMA_NAME)); mn->headers.push_back(pair<const char*,const char*>("/",XML_SCHEMA_NAME));
root.Sons.push_back(mn); root.Sons.push_back(mn);
} }
void XMLTree::addHeaders(char* str, char*val) void XMLTree::addHeaders(const char* str, const char*val)
{ {
MainNode* mn = (MainNode*) root.Sons.front(); MainNode* mn = (MainNode*) root.Sons.front();
mn->headers.push_back(pair<char*,char*>(str,val)); mn->headers.push_back(pair<const char*,const char*>(str,val));
} }
void XMLTree::addSlots(SlotNode* sn) void XMLTree::addSlots(SlotNode* sn)
@ -166,7 +166,7 @@ void XMLTree::addClasses(ClassNode* cn)
root.Sons.push_back(cn0); root.Sons.push_back(cn0);
} }
void XMLTree::addNode(char* s, int value_type, char* name) void XMLTree::addNode(const char* s, int value_type, const char* name)
{ {
ValueNode* vn = new ValueNode; ValueNode* vn = new ValueNode;
@ -227,7 +227,7 @@ void XMLTree::printXMLTree()
list<Node*>::iterator it; list<Node*>::iterator it;
list<Node*>::iterator it2; list<Node*>::iterator it2;
list<Node*>::iterator it3; list<Node*>::iterator it3;
list<pair<char*,char*> >::iterator lit; list<pair<const char*,const char*> >::iterator lit;
MainNode* mn; MainNode* mn;
SlotsNode* sns; SlotsNode* sns;
SlotNode* sn; SlotNode* sn;
@ -337,4 +337,4 @@ void XMLTree::printXMLTree()
++nn; ++nn;
} }
fclose(fp); fclose(fp);
} }