summaryrefslogtreecommitdiffstats
path: root/xmlserializer
diff options
context:
space:
mode:
Diffstat (limited to 'xmlserializer')
-rw-r--r--xmlserializer/XmlDocSource.cpp2
-rw-r--r--xmlserializer/XmlDocSource.h40
-rw-r--r--xmlserializer/XmlElement.cpp3
-rw-r--r--xmlserializer/XmlElement.h42
-rw-r--r--xmlserializer/XmlFileDocSink.cpp2
-rw-r--r--xmlserializer/XmlFileDocSink.h4
-rw-r--r--xmlserializer/XmlFileDocSource.cpp18
-rw-r--r--xmlserializer/XmlFileDocSource.h16
-rw-r--r--xmlserializer/XmlMemoryDocSource.cpp10
-rw-r--r--xmlserializer/XmlMemoryDocSource.h16
-rw-r--r--xmlserializer/XmlSerializingContext.cpp8
-rw-r--r--xmlserializer/XmlSerializingContext.h12
-rw-r--r--xmlserializer/XmlStringDocSink.cpp2
-rw-r--r--xmlserializer/XmlStringDocSink.h14
-rw-r--r--xmlserializer/XmlStringDocSource.cpp10
-rw-r--r--xmlserializer/XmlStringDocSource.h12
16 files changed, 104 insertions, 107 deletions
diff --git a/xmlserializer/XmlDocSource.cpp b/xmlserializer/XmlDocSource.cpp
index 5e53a81..35a8f4e 100644
--- a/xmlserializer/XmlDocSource.cpp
+++ b/xmlserializer/XmlDocSource.cpp
@@ -33,6 +33,8 @@
#include <libxml/xmlschemas.h>
#include <stdlib.h>
+using std::string;
+
// Schedule for libxml2 library
bool CXmlDocSource::_bLibXml2CleanupScheduled;
diff --git a/xmlserializer/XmlDocSource.h b/xmlserializer/XmlDocSource.h
index fd9a693..e7be8f3 100644
--- a/xmlserializer/XmlDocSource.h
+++ b/xmlserializer/XmlDocSource.h
@@ -60,16 +60,16 @@ public:
* Constructor
*
* @param[out] pDoc a pointer to the xml document that will be filled by the class
- * @param[in] strXmlSchemaFile a string containing the path to the schema file
- * @param[in] strRootElementType a string containing the root element type
- * @param[in] strRootElementName a string containing the root element name
- * @param[in] strNameAttributeName a string containing the name of the root name attribute
+ * @param[in] strXmlSchemaFile a std::string containing the path to the schema file
+ * @param[in] strRootElementType a std::string containing the root element type
+ * @param[in] strRootElementName a std::string containing the root element name
+ * @param[in] strNameAttributeName a std::string containing the name of the root name attribute
*/
CXmlDocSource(_xmlDoc* pDoc,
- const string& strXmlSchemaFile,
- const string& strRootElementType,
- const string& strRootElementName,
- const string& strNameAttrituteName);
+ const std::string& strXmlSchemaFile,
+ const std::string& strRootElementType,
+ const std::string& strRootElementName,
+ const std::string& strNameAttrituteName);
/**
* Constructor
@@ -82,10 +82,10 @@ public:
* @param[in] bValidateWithSchema a boolean that toggles schema validation
*/
CXmlDocSource(_xmlDoc* pDoc,
- const string& strXmlSchemaFile,
- const string& strRootElementType,
- const string& strRootElementName,
- const string& strNameAttrituteName,
+ const std::string& strXmlSchemaFile,
+ const std::string& strRootElementType,
+ const std::string& strRootElementName,
+ const std::string& strNameAttrituteName,
bool bValidateWithSchema);
/**
@@ -95,7 +95,7 @@ public:
* @param[in] strXmlSchemaFile a string containing the path to the schema file
* @param[in] strRootElementType a string containing the root element type
*/
- CXmlDocSource(_xmlDoc* pDoc, const string& strXmlSchemaFile, const string& strRootElementType,
+ CXmlDocSource(_xmlDoc* pDoc, const std::string& strXmlSchemaFile, const std::string& strRootElementType,
bool bValidateWithSchema);
/**
@@ -124,17 +124,17 @@ public:
*
* @return the root element's name
*/
- string getRootElementName() const;
+ std::string getRootElementName() const;
/**
* Getter method.
* Method that returns the root element's attribute with name matching strAttributeName.
*
- * @param[in] strAttributeName is a string used to find the corresponding attribute
+ * @param[in] strAttributeName is a std::string used to find the corresponding attribute
*
* @return the value of the root's attribute named as strAttributeName
*/
- string getRootElementAttributeString(const string& strAttributeName) const;
+ std::string getRootElementAttributeString(const std::string& strAttributeName) const;
/**
* Getter method.
@@ -195,22 +195,22 @@ private:
/**
* Schema file
*/
- string _strXmlSchemaFile;
+ std::string _strXmlSchemaFile;
/**
* Element type info
*/
- string _strRootElementType;
+ std::string _strRootElementType;
/**
* Element name info
*/
- string _strRootElementName;
+ std::string _strRootElementName;
/**
* Element name attribute info
*/
- string _strNameAttrituteName;
+ std::string _strNameAttrituteName;
/**
* Boolean that enables the root element name attribute check
diff --git a/xmlserializer/XmlElement.cpp b/xmlserializer/XmlElement.cpp
index bda3973..106bfdc 100644
--- a/xmlserializer/XmlElement.cpp
+++ b/xmlserializer/XmlElement.cpp
@@ -32,6 +32,9 @@
#include <stdlib.h>
#include <sstream>
+using std::string;
+using std::ostringstream;
+
CXmlElement::CXmlElement(_xmlNode* pXmlElement) : _pXmlElement(pXmlElement)
{
}
diff --git a/xmlserializer/XmlElement.h b/xmlserializer/XmlElement.h
index aff9e4c..9c5ca0e 100644
--- a/xmlserializer/XmlElement.h
+++ b/xmlserializer/XmlElement.h
@@ -32,8 +32,6 @@
#include <stdint.h>
#include <string>
-using namespace std;
-
struct _xmlNode;
struct _xmlDoc;
@@ -48,34 +46,34 @@ public:
void setXmlElement(_xmlNode* pXmlElement);
// Getters
- string getType() const;
- string getPath() const;
- string getNameAttribute() const;
- bool hasAttribute(const string& strAttributeName) const;
- bool getAttributeBoolean(const string& strAttributeName, const string& strTrueValue) const;
- bool getAttributeBoolean(const string& strAttributeName) const;
- string getAttributeString(const string& strAttributeName) const;
- uint32_t getAttributeInteger(const string& strAttributeName) const;
- int32_t getAttributeSignedInteger(const string& strAttributeName) const;
- double getAttributeDouble(const string& strAttributeName) const;
- string getTextContent() const;
+ std::string getType() const;
+ std::string getPath() const;
+ std::string getNameAttribute() const;
+ bool hasAttribute(const std::string& strAttributeName) const;
+ bool getAttributeBoolean(const std::string& strAttributeName, const std::string& strTrueValue) const;
+ bool getAttributeBoolean(const std::string& strAttributeName) const;
+ std::string getAttributeString(const std::string& strAttributeName) const;
+ uint32_t getAttributeInteger(const std::string& strAttributeName) const;
+ int32_t getAttributeSignedInteger(const std::string& strAttributeName) const;
+ double getAttributeDouble(const std::string& strAttributeName) const;
+ std::string getTextContent() const;
// Navigation
- bool getChildElement(const string& strType, CXmlElement& childElement) const;
- bool getChildElement(const string& strType, const string& strNameAttribute, CXmlElement& childElement) const;
+ bool getChildElement(const std::string& strType, CXmlElement& childElement) const;
+ bool getChildElement(const std::string& strType, const std::string& strNameAttribute, CXmlElement& childElement) const;
uint32_t getNbChildElements() const;
bool getParentElement(CXmlElement& parentElement) const;
// Setters
- void setAttributeBoolean(const string& strAttributeName, bool bValue);
- void setAttributeString(const string& strAttributeName, const string& strValue);
- void setNameAttribute(const string& strValue);
- void setTextContent(const string& strContent);
- void setComment(const string& strComment);
- void setAttributeInteger(const string& strAttributeName, uint32_t uiValue);
+ void setAttributeBoolean(const std::string& strAttributeName, bool bValue);
+ void setAttributeString(const std::string& strAttributeName, const std::string& strValue);
+ void setNameAttribute(const std::string& strValue);
+ void setTextContent(const std::string& strContent);
+ void setComment(const std::string& strComment);
+ void setAttributeInteger(const std::string& strAttributeName, uint32_t uiValue);
// Child creation
- void createChild(CXmlElement& childElement, const string& strType);
+ void createChild(CXmlElement& childElement, const std::string& strType);
public:
// Child iteration
diff --git a/xmlserializer/XmlFileDocSink.cpp b/xmlserializer/XmlFileDocSink.cpp
index e3360ea..f73860c 100644
--- a/xmlserializer/XmlFileDocSink.cpp
+++ b/xmlserializer/XmlFileDocSink.cpp
@@ -33,7 +33,7 @@
#define base CXmlDocSink
-CXmlFileDocSink::CXmlFileDocSink(const string& strXmlInstanceFile):
+CXmlFileDocSink::CXmlFileDocSink(const std::string& strXmlInstanceFile):
_strXmlInstanceFile(strXmlInstanceFile)
{
}
diff --git a/xmlserializer/XmlFileDocSink.h b/xmlserializer/XmlFileDocSink.h
index f7362f2..6063e6a 100644
--- a/xmlserializer/XmlFileDocSink.h
+++ b/xmlserializer/XmlFileDocSink.h
@@ -44,7 +44,7 @@ public:
*
* @param[in] strXmlInstanceFile defines the path used to save the file.
*/
- CXmlFileDocSink(const string& strXmlInstanceFile);
+ CXmlFileDocSink(const std::string& strXmlInstanceFile);
private:
/**
@@ -62,5 +62,5 @@ private:
/**
* Name of the instance file
*/
- string _strXmlInstanceFile;
+ std::string _strXmlInstanceFile;
};
diff --git a/xmlserializer/XmlFileDocSource.cpp b/xmlserializer/XmlFileDocSource.cpp
index 908c13b..f980c39 100644
--- a/xmlserializer/XmlFileDocSource.cpp
+++ b/xmlserializer/XmlFileDocSource.cpp
@@ -34,11 +34,11 @@
#define base CXmlDocSource
-CXmlFileDocSource::CXmlFileDocSource(const string& strXmlInstanceFile,
- const string& strXmlSchemaFile,
- const string& strRootElementType,
- const string& strRootElementName,
- const string& strNameAttrituteName,
+CXmlFileDocSource::CXmlFileDocSource(const std::string& strXmlInstanceFile,
+ const std::string& strXmlSchemaFile,
+ const std::string& strRootElementType,
+ const std::string& strRootElementName,
+ const std::string& strNameAttrituteName,
bool bValidateWithSchema) :
base(readFile(strXmlInstanceFile),
strXmlSchemaFile,
@@ -50,9 +50,9 @@ CXmlFileDocSource::CXmlFileDocSource(const string& strXmlInstanceFile,
{
}
-CXmlFileDocSource::CXmlFileDocSource(const string& strXmlInstanceFile,
- const string& strXmlSchemaFile,
- const string& strRootElementType,
+CXmlFileDocSource::CXmlFileDocSource(const std::string& strXmlInstanceFile,
+ const std::string& strXmlSchemaFile,
+ const std::string& strRootElementType,
bool bValidateWithSchema) :
base(readFile(strXmlInstanceFile),
strXmlSchemaFile,
@@ -88,7 +88,7 @@ bool CXmlFileDocSource::populate(CXmlSerializingContext& serializingContext)
return true;
}
-_xmlDoc* CXmlFileDocSource::readFile(const string& strFileName)
+_xmlDoc* CXmlFileDocSource::readFile(const std::string& strFileName)
{
// Read xml file
xmlDocPtr pDoc = xmlReadFile(strFileName.c_str(), NULL, 0);
diff --git a/xmlserializer/XmlFileDocSource.h b/xmlserializer/XmlFileDocSource.h
index b8b0c6b..f7b2e30 100644
--- a/xmlserializer/XmlFileDocSource.h
+++ b/xmlserializer/XmlFileDocSource.h
@@ -49,11 +49,11 @@ public:
* @param[in] strNameAttributeName a string containing the name of the root name attribute
* @param[in] bValidateWithSchema a boolean that toggles schema validation
*/
- CXmlFileDocSource(const string& strXmlInstanceFile,
- const string& strXmlSchemaFile,
- const string& strRootElementType,
- const string& strRootElementName,
- const string& strNameAttrituteName,
+ CXmlFileDocSource(const std::string& strXmlInstanceFile,
+ const std::string& strXmlSchemaFile,
+ const std::string& strRootElementType,
+ const std::string& strRootElementName,
+ const std::string& strNameAttrituteName,
bool bValidateWithSchema);
/**
* Constructor
@@ -63,7 +63,7 @@ public:
* @param[in] strRootElementType a string containing the root element type
* @param[in] bValidateWithSchema a boolean that toggles schema validation
*/
- CXmlFileDocSource(const string& strXmlInstanceFile, const string& strXmlSchemaFile, const string& strRootElementType,
+ CXmlFileDocSource(const std::string& strXmlInstanceFile, const std::string& strXmlSchemaFile, const std::string& strRootElementType,
bool bValidateWithSchema);
/**
@@ -95,10 +95,10 @@ private:
*
* @return a pointer to generated xml document object
*/
- static _xmlDoc* readFile(const string& strFileName);
+ static _xmlDoc* readFile(const std::string& strFileName);
/**
* Instance file
*/
- string _strXmlInstanceFile;
+ std::string _strXmlInstanceFile;
};
diff --git a/xmlserializer/XmlMemoryDocSource.cpp b/xmlserializer/XmlMemoryDocSource.cpp
index 85abbfc..411d98a 100644
--- a/xmlserializer/XmlMemoryDocSource.cpp
+++ b/xmlserializer/XmlMemoryDocSource.cpp
@@ -35,10 +35,10 @@
#define base CXmlDocSource
CXmlMemoryDocSource::CXmlMemoryDocSource(const IXmlSource* pXmlSource,
- const string& strRootElementType,
- const string& strXmlSchemaFile,
- const string& strProduct,
- const string& strVersion,
+ const std::string& strRootElementType,
+ const std::string& strXmlSchemaFile,
+ const std::string& strProduct,
+ const std::string& strVersion,
bool bValidateWithSchema):
base(xmlNewDoc(BAD_CAST "1.0"), xmlNewNode(NULL, BAD_CAST strRootElementType.c_str()),
bValidateWithSchema),
@@ -49,7 +49,7 @@ CXmlMemoryDocSource::CXmlMemoryDocSource(const IXmlSource* pXmlSource,
}
CXmlMemoryDocSource::CXmlMemoryDocSource(const IXmlSource* pXmlSource,
- const string& strRootElementType,
+ const std::string& strRootElementType,
bool bValidateWithSchema):
base(xmlNewDoc(BAD_CAST "1.0"), xmlNewNode(NULL, BAD_CAST strRootElementType.c_str()),
bValidateWithSchema),
diff --git a/xmlserializer/XmlMemoryDocSource.h b/xmlserializer/XmlMemoryDocSource.h
index 072cb06..3266782 100644
--- a/xmlserializer/XmlMemoryDocSource.h
+++ b/xmlserializer/XmlMemoryDocSource.h
@@ -33,8 +33,6 @@
#include "XmlDocSource.h"
#include "XmlSource.h"
-using std::string;
-
/**
* Source class that uses parameter-framework's structures to create an xml document
*/
@@ -52,9 +50,9 @@ public:
* @param[in] strVersion a string containing the version number
* @param[in] bValidateWithSchema a boolean that toggles schema validation
*/
- CXmlMemoryDocSource(const IXmlSource* pXmlSource, const string& strRootElementType,
- const string& strXmlSchemaFile, const string& strProduct,
- const string& strVersion,
+ CXmlMemoryDocSource(const IXmlSource* pXmlSource, const std::string& strRootElementType,
+ const std::string& strXmlSchemaFile, const std::string& strProduct,
+ const std::string& strVersion,
bool bValidateWithSchema);
/**
@@ -65,7 +63,7 @@ public:
* @param[in] strRootElementType a string containing the root element type
* @param[in] bValidateWithSchema a boolean that toggles schema validation
*/
- CXmlMemoryDocSource(const IXmlSource* pXmlSource, const string& strRootElementType, bool bValidateWithSchema);
+ CXmlMemoryDocSource(const IXmlSource* pXmlSource, const std::string& strRootElementType, bool bValidateWithSchema);
/**
* Implementation of CXmlDocSource::populate() method.
@@ -91,7 +89,7 @@ private:
/**
* Schema file
*/
- string _strXmlSchemaFile;
+ std::string _strXmlSchemaFile;
/**
* Boolean used to specify if a header should be added in the Xml Doc
@@ -99,6 +97,6 @@ private:
bool _bWithHeader;
// Product and version info
- string _strProduct;
- string _strVersion;
+ std::string _strProduct;
+ std::string _strVersion;
};
diff --git a/xmlserializer/XmlSerializingContext.cpp b/xmlserializer/XmlSerializingContext.cpp
index ba01c6e..9adef31 100644
--- a/xmlserializer/XmlSerializingContext.cpp
+++ b/xmlserializer/XmlSerializingContext.cpp
@@ -29,22 +29,22 @@
*/
#include "XmlSerializingContext.h"
-CXmlSerializingContext::CXmlSerializingContext(string& strError) : _strError(strError)
+CXmlSerializingContext::CXmlSerializingContext(std::string& strError) : _strError(strError)
{
}
// Error
-void CXmlSerializingContext::setError(const string& strError)
+void CXmlSerializingContext::setError(const std::string& strError)
{
_strError = strError;
}
-void CXmlSerializingContext::appendLineToError(const string& strAppend)
+void CXmlSerializingContext::appendLineToError(const std::string& strAppend)
{
_strError += "\n" + strAppend;
}
-const string& CXmlSerializingContext::getError() const
+const std::string& CXmlSerializingContext::getError() const
{
return _strError;
}
diff --git a/xmlserializer/XmlSerializingContext.h b/xmlserializer/XmlSerializingContext.h
index 129eb52..b72e5d1 100644
--- a/xmlserializer/XmlSerializingContext.h
+++ b/xmlserializer/XmlSerializingContext.h
@@ -31,18 +31,16 @@
#include <string>
-using namespace std;
-
class CXmlSerializingContext
{
public:
- CXmlSerializingContext(string& strError);
+ CXmlSerializingContext(std::string& strError);
// Error
- void setError(const string& strError);
- void appendLineToError(const string& strAppend);
- const string& getError() const;
+ void setError(const std::string& strError);
+ void appendLineToError(const std::string& strAppend);
+ const std::string& getError() const;
private:
- string& _strError;
+ std::string& _strError;
};
diff --git a/xmlserializer/XmlStringDocSink.cpp b/xmlserializer/XmlStringDocSink.cpp
index 8226855..4b05d85 100644
--- a/xmlserializer/XmlStringDocSink.cpp
+++ b/xmlserializer/XmlStringDocSink.cpp
@@ -33,7 +33,7 @@
#define base CXmlDocSink
-CXmlStringDocSink::CXmlStringDocSink(string& strResult):
+CXmlStringDocSink::CXmlStringDocSink(std::string& strResult):
_strResult(strResult)
{
}
diff --git a/xmlserializer/XmlStringDocSink.h b/xmlserializer/XmlStringDocSink.h
index 174bf2c..22fa3a1 100644
--- a/xmlserializer/XmlStringDocSink.h
+++ b/xmlserializer/XmlStringDocSink.h
@@ -33,20 +33,18 @@
#include "XmlDocSink.h"
#include "XmlSource.h"
-using std::string;
-
/**
- * Sink class that writes the content of any CXmlDocSource into a string.
- * A reference to an empty string is given in the constructor.
+ * Sink class that writes the content of any CXmlDocSource into a std::string.
+ * A reference to an empty std::string is given in the constructor.
*/
class CXmlStringDocSink : public CXmlDocSink
{
public:
/** Constructor
*
- * @param[out] strResult a reference to a string that will be filled by the doProcess method
+ * @param[out] strResult a reference to a std::string that will be filled by the doProcess method
*/
- CXmlStringDocSink(string& strResult);
+ CXmlStringDocSink(std::string& strResult);
private:
/** Implementation of CXmlDocSink::doProcess()
@@ -60,8 +58,8 @@ private:
virtual bool doProcess(CXmlDocSource& xmlDocSource, CXmlSerializingContext& serializingContext);
/**
- * Result string containing the XML informations
+ * Result std::string containing the XML informations
*/
- string& _strResult;
+ std::string& _strResult;
};
diff --git a/xmlserializer/XmlStringDocSource.cpp b/xmlserializer/XmlStringDocSource.cpp
index 12307f2..ec2d7e9 100644
--- a/xmlserializer/XmlStringDocSource.cpp
+++ b/xmlserializer/XmlStringDocSource.cpp
@@ -33,11 +33,11 @@
#define base CXmlDocSource
-CXmlStringDocSource::CXmlStringDocSource(const string& strXmlInput,
- const string& strXmlSchemaFile,
- const string& strRootElementType,
- const string& strRootElementName,
- const string& strNameAttrituteName,
+CXmlStringDocSource::CXmlStringDocSource(const std::string& strXmlInput,
+ const std::string& strXmlSchemaFile,
+ const std::string& strRootElementType,
+ const std::string& strRootElementName,
+ const std::string& strNameAttrituteName,
bool bValidateWithSchema) :
base(xmlReadMemory(strXmlInput.c_str(), strXmlInput.size(), "", NULL, 0),
strXmlSchemaFile,
diff --git a/xmlserializer/XmlStringDocSource.h b/xmlserializer/XmlStringDocSource.h
index d7cde9b..06a0337 100644
--- a/xmlserializer/XmlStringDocSource.h
+++ b/xmlserializer/XmlStringDocSource.h
@@ -33,7 +33,7 @@
#include <string>
/**
- * Source class that get an xml document from a string.
+ * Source class that get an xml document from a std::string.
* Its base class will check the validity of the document.
*/
class CXmlStringDocSource : public CXmlDocSource
@@ -49,11 +49,11 @@ public:
* @param[in] strNameAttributeName a string containing the name of the root name attribute
* @param[in] bValidateWithSchema a boolean that toggles schema validation
*/
- CXmlStringDocSource(const string& strXmlInput,
- const string& strXmlSchemaFile,
- const string& strRootElementType,
- const string& strRootElementName,
- const string& strNameAttrituteName,
+ CXmlStringDocSource(const std::string& strXmlInput,
+ const std::string& strXmlSchemaFile,
+ const std::string& strRootElementType,
+ const std::string& strRootElementName,
+ const std::string& strNameAttrituteName,
bool bValidateWithSchema);
/**