[gnote] Replace std::string by Glib::ustring in XmlReader



commit 9e1f59814f42eb375e43cf18a7277e4fb437ed81
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Fri Jan 27 23:07:50 2017 +0200

    Replace std::string by Glib::ustring in XmlReader

 src/sharp/xmlreader.cpp |   24 ++++++++++++------------
 src/sharp/xmlreader.hpp |   23 +++++++++++------------
 2 files changed, 23 insertions(+), 24 deletions(-)
---
diff --git a/src/sharp/xmlreader.cpp b/src/sharp/xmlreader.cpp
index e8ca549..97f467d 100644
--- a/src/sharp/xmlreader.cpp
+++ b/src/sharp/xmlreader.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2013,2016 Aurimas Cernius
+ * Copyright (C) 2013,2016-2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -33,17 +33,17 @@
 
 namespace sharp {
 
-  std::string xmlchar_to_string(const xmlChar * s)
+  Glib::ustring xmlchar_to_string(const xmlChar * s)
   {
     return (s ? (const char*)s : "");
   }
 
-  std::string xmlchar_to_string(xmlChar * s, bool freemem)
+  Glib::ustring xmlchar_to_string(xmlChar * s, bool freemem)
   {
     if(s == NULL) {
       return "";
     }
-    std::string value = (const char*)s;
+    Glib::ustring value = (const char*)s;
     if(freemem) {
       xmlFree(s);
     }
@@ -57,7 +57,7 @@ namespace sharp {
     m_error = true;
   }
 
-  XmlReader::XmlReader(const std::string & filename)
+  XmlReader::XmlReader(const Glib::ustring & filename)
     : m_reader(NULL)
     , m_error(false)
   {
@@ -78,7 +78,7 @@ namespace sharp {
   /** load the buffer from the s
    *  The parser is reset.
    */
-  void XmlReader::load_buffer(const std::string &s)
+  void XmlReader::load_buffer(const Glib::ustring &s)
   {
     close();
     /** we copy the string. It shouldn't be a big deal as the strings
@@ -118,32 +118,32 @@ namespace sharp {
     return xmlTextReaderIsEmptyElement(m_reader) == 1;
   }
 
-  std::string XmlReader::get_name()
+  Glib::ustring XmlReader::get_name()
   {
     return xmlchar_to_string(xmlTextReaderConstName(m_reader));
   }
 
-  std::string XmlReader::get_attribute(const char * name)
+  Glib::ustring XmlReader::get_attribute(const char * name)
   {
     return xmlchar_to_string(xmlTextReaderGetAttribute(m_reader, (const xmlChar*)name), true);
   }
 
-  std::string XmlReader::get_value()
+  Glib::ustring XmlReader::get_value()
   {
     return xmlchar_to_string(xmlTextReaderConstValue(m_reader));
   }
 
-  std::string XmlReader::read_string()
+  Glib::ustring XmlReader::read_string()
   {
     return xmlchar_to_string(xmlTextReaderReadString(m_reader), true);
   }
 
-  std::string XmlReader::read_inner_xml()
+  Glib::ustring XmlReader::read_inner_xml()
   {
     return xmlchar_to_string(xmlTextReaderReadInnerXml(m_reader), true);
   }
 
-  std::string XmlReader::read_outer_xml()
+  Glib::ustring XmlReader::read_outer_xml()
   {
     return xmlchar_to_string(xmlTextReaderReadOuterXml(m_reader), true);
   }
diff --git a/src/sharp/xmlreader.hpp b/src/sharp/xmlreader.hpp
index 6dc55c0..a423fa2 100644
--- a/src/sharp/xmlreader.hpp
+++ b/src/sharp/xmlreader.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2016 Aurimas Cernius
+ * Copyright (C) 2016-2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -29,9 +29,8 @@
 #ifndef __SHARP_XMLREADER_HPP_
 #define __SHARP_XMLREADER_HPP_
 
-#include <string>
-
 #include <boost/noncopyable.hpp>
+#include <glibmm/ustring.h>
 #include <libxml/xmlreader.h>
 
 namespace sharp {
@@ -43,13 +42,13 @@ public:
   /** Create a XmlReader to read from a buffer */
   XmlReader();
   /** Create a XmlReader to read from a file */
-  XmlReader(const std::string & filename);
+  XmlReader(const Glib::ustring & filename);
   ~XmlReader();
 
   /** load the buffer from the s 
    *  The parser is reset.
    */
-  void load_buffer(const std::string &s);
+  void load_buffer(const Glib::ustring &s);
   
 
   /** read the next node 
@@ -59,13 +58,13 @@ public:
 
   xmlReaderTypes get_node_type();
   
-  std::string    get_name();
+  Glib::ustring  get_name();
   bool           is_empty_element();
-  std::string    get_attribute(const char *);
-  std::string    get_value();
-  std::string    read_string();
-  std::string    read_inner_xml();
-  std::string    read_outer_xml();
+  Glib::ustring  get_attribute(const char *);
+  Glib::ustring  get_value();
+  Glib::ustring  read_string();
+  Glib::ustring  read_inner_xml();
+  Glib::ustring  read_outer_xml();
   bool           move_to_next_attribute();
   bool           read_attribute_value();
 
@@ -75,7 +74,7 @@ private:
   void setup_error_handling();
   static void error_handler(void* arg, const char* msg, int severity, void* locator);
 
-  std::string      m_buffer;
+  Glib::ustring    m_buffer;
   xmlTextReaderPtr m_reader;
   // error signaling
   bool             m_error;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]