Commit aec9fd2d authored by Alexey.Musinov's avatar Alexey.Musinov Committed by Alexander Trofimov

выпиливание boost'a

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@52942 954022d7-b5bf-4e40-9824-e11837661b57
parent 2f99fb0d
......@@ -47,14 +47,14 @@ namespace XML
}
Element::Element(boost::shared_ptr<XSingleSource> source, const XNamespaceContainer& ns, const XSpace& space)
Element::Element(NSCommon::smart_ptr<XSingleSource> source, const XNamespaceContainer& ns, const XSpace& space)
: Space(space)
{
fromSource(source, ns, Space);
}
Element::Element(boost::shared_ptr<XWideSource> source, const XNamespaceContainer& ns, const XSpace& space)
Element::Element(NSCommon::smart_ptr<XWideSource> source, const XNamespaceContainer& ns, const XSpace& space)
: Space(space)
{
fromSource(source, ns, Space);
......@@ -84,7 +84,7 @@ namespace XML
}
void Element::fromSource(boost::shared_ptr<XSingleSource> source, const XNamespaceContainer& defineNamespaces, const XSpace& space)
void Element::fromSource(NSCommon::smart_ptr<XSingleSource> source, const XNamespaceContainer& defineNamespaces, const XSpace& space)
{
Space = space;
source->skipSpace();
......@@ -179,7 +179,7 @@ namespace XML
}
void Element::fromSource(boost::shared_ptr<XWideSource> source, const XNamespaceContainer& defineNamespaces, const XSpace& space)
void Element::fromSource(NSCommon::smart_ptr<XWideSource> source, const XNamespaceContainer& defineNamespaces, const XSpace& space)
{
Space = space;
source->skipSpace();
......
......@@ -2,19 +2,18 @@
#ifndef XML_PRIVATE_ELEMENT_INCLUDE_H_
#define XML_PRIVATE_XELEMENT_INCLUDE_H_
#include <list>
#include <string>
#include "NodeContainer.h"
#include "property.h"
#include "XAttributeContainer.h"
#include "XNamespaceContainer.h"
#include "./../XName.h"
#include <string>
#include "XString.h"
#include "XSpace.h"
//#include "XSource.h"
#include "XSingleSource.h"
#include "XWideSource.h"
#include <list>
namespace XML
{
......@@ -34,8 +33,8 @@ namespace XML
Element();
Element(const XML::XName& xname);
Element(const XML::XName& xname, const XList& list);
Element(boost::shared_ptr<XSingleSource> source, const XNamespaceContainer& ns, const XSpace& space);
Element(boost::shared_ptr<XWideSource> source, const XNamespaceContainer& ns, const XSpace& space);
Element(NSCommon::smart_ptr<XSingleSource> source, const XNamespaceContainer& ns, const XSpace& space);
Element(NSCommon::smart_ptr<XWideSource> source, const XNamespaceContainer& ns, const XSpace& space);
virtual ~Element();
......@@ -45,8 +44,8 @@ namespace XML
virtual const bool isComment() const;
public:
void fromSource(boost::shared_ptr<XSingleSource> source, const XNamespaceContainer& defineNamespaces, const XSpace& space);
void fromSource(boost::shared_ptr<XWideSource> source, const XNamespaceContainer& defineNamespaces, const XSpace& space);
void fromSource(NSCommon::smart_ptr<XSingleSource> source, const XNamespaceContainer& defineNamespaces, const XSpace& space);
void fromSource(NSCommon::smart_ptr<XWideSource> source, const XNamespaceContainer& defineNamespaces, const XSpace& space);
virtual const std::string ToString() const;
virtual const std::wstring ToWString() const;
virtual void SaveToStringList(std::list<std::string>& strList)const;
......
......@@ -5,7 +5,6 @@
#include <string>
#include <list>
namespace XML
{
namespace Private
......
......@@ -93,7 +93,7 @@ namespace XML
}
void NodeContainer::fromSource(boost::shared_ptr<XSingleSource> source, const XNamespaceContainer& ns, const XSpace& space)
void NodeContainer::fromSource(NSCommon::smart_ptr<XSingleSource> source, const XNamespaceContainer& ns, const XSpace& space)
{
if (space.isDefault())
source->skipSpace();
......@@ -121,7 +121,7 @@ namespace XML
}
void NodeContainer::fromSource(boost::shared_ptr<XWideSource> source, const XNamespaceContainer& ns, const XSpace& space)
void NodeContainer::fromSource(NSCommon::smart_ptr<XWideSource> source, const XNamespaceContainer& ns, const XSpace& space)
{
if (space.isDefault())
source->skipSpace();
......@@ -204,7 +204,7 @@ namespace XML
}
const bool NodeContainer::isComment(boost::shared_ptr<XSingleSource> source)
const bool NodeContainer::isComment(NSCommon::smart_ptr<XSingleSource> source)
{
if (source->get() == '!')
{
......@@ -223,7 +223,7 @@ namespace XML
}
void NodeContainer::insertComment(boost::shared_ptr<XSingleSource> source)
void NodeContainer::insertComment(NSCommon::smart_ptr<XSingleSource> source)
{
std::string comment;
while(true)
......@@ -252,7 +252,7 @@ namespace XML
}
const bool NodeContainer::isComment(boost::shared_ptr<XWideSource> source)
const bool NodeContainer::isComment(NSCommon::smart_ptr<XWideSource> source)
{
if (source->get() == L'!')
{
......@@ -271,7 +271,7 @@ namespace XML
}
void NodeContainer::insertComment(boost::shared_ptr<XWideSource> source)
void NodeContainer::insertComment(NSCommon::smart_ptr<XWideSource> source)
{
std::wstring comment;
while(true)
......
......@@ -2,8 +2,10 @@
#ifndef XML_PRIVATE_NODE_CONTAINER_INCLUDE_H_
#define XML_PRIVATE_NODE_CONTAINER_INCLUDE_H_
#include "Node.h"
#include <string>
#include <list>
#include "Node.h"
#include "XNodeContainer.h"
#include "XElementContainer.h"
#include "XTextContainer.h"
......@@ -11,7 +13,8 @@
#include "XSpace.h"
#include "XSingleSource.h"
#include "XWideSource.h"
#include <list>
#include "../../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
namespace XML
{
......@@ -43,8 +46,8 @@ namespace XML
virtual const bool isComment() const;
public:
void fromSource(boost::shared_ptr<XSingleSource> source, const XNamespaceContainer& ns, const XSpace& space);
void fromSource(boost::shared_ptr<XWideSource> source, const XNamespaceContainer& ns, const XSpace& space);
void fromSource(NSCommon::smart_ptr<XSingleSource> source, const XNamespaceContainer& ns, const XSpace& space);
void fromSource(NSCommon::smart_ptr<XWideSource> source, const XNamespaceContainer& ns, const XSpace& space);
virtual const std::string ToString() const;
virtual const std::wstring ToWString() const;
virtual void SaveToStringList(std::list<std::string>& strList)const;
......@@ -52,10 +55,7 @@ namespace XML
public:
template<template<typename T, typename A> class C, typename T, typename A>
explicit NodeContainer(const C<T, A>& container)
: Nodes(),
Elements(Nodes),
Texts(Nodes)
explicit NodeContainer(const C<T, A>& container) : Nodes(), Elements(Nodes), Texts(Nodes)
{
for (C<T, A>::const_iterator i = container.begin(); i != container.end(); ++i)
Nodes.push_back(Write(*i));
......@@ -69,10 +69,10 @@ namespace XML
void Add(const XList& list);
private:
const bool isComment(boost::shared_ptr<XSingleSource> source);
void insertComment(boost::shared_ptr<XSingleSource> source);
const bool isComment(boost::shared_ptr<XWideSource> source);
void insertComment(boost::shared_ptr<XWideSource> source);
const bool isComment(NSCommon::smart_ptr<XSingleSource> source);
void insertComment(NSCommon::smart_ptr<XSingleSource> source);
const bool isComment(NSCommon::smart_ptr<XWideSource> source);
void insertComment(NSCommon::smart_ptr<XWideSource> source);
public:
XNodeContainer Nodes;
......
......@@ -6,21 +6,15 @@
#include "XDeclaration.h"
#include "Encoding.h"
namespace XML
{
namespace Private
{
XDeclaration::XDeclaration()
: Version("1.0"),
Encoding("UTF-8"),
Standalone("yes")
XDeclaration::XDeclaration() : Version("1.0"), Encoding("UTF-8"), Standalone("yes")
{
}
void XDeclaration::fromSource(boost::shared_ptr<XSingleSource> source)
void XDeclaration::fromSource(NSCommon::smart_ptr<XSingleSource> source)
{
source->find('?');
source->next();
......@@ -36,8 +30,7 @@ namespace XML
source->next();
}
void XDeclaration::fromSource(boost::shared_ptr<XWideSource> source)
void XDeclaration::fromSource(NSCommon::smart_ptr<XWideSource> source)
{
source->find(L'?');
source->next();
......@@ -53,21 +46,18 @@ namespace XML
source->next();
}
const std::string XDeclaration::ToString() const
{
return "<?xml version=\"" + Version.ToString() + "\" encoding=\"" + Encoding.ToString() +
(Standalone.is_init() ? ("\" standalone=\"" + Standalone.ToString()) : "") + "\" ?>";
}
const std::wstring XDeclaration::ToWString() const
{
return L"<?xml version=\"" + Encoding::utf82unicode(Version.ToString()) + L"\" encoding=\"" + L"Unicode" +
(Standalone.is_init() ? (L"\" standalone=\"" + Encoding::utf82unicode(Standalone.ToString())) : L"") + L"\" ?>";
}
void XDeclaration::setValue(const std::string& name, const std::string& value)
{
if (name == "version")
......
......@@ -3,15 +3,16 @@
#define XML_XDECLARATION_INCLUDE_H_
#include <string>
#include "property.h"
#include "nullable_property.h"
#include "./../Limit/Version.h"
#include "./../Limit/Encoding.h"
#include "./../Limit/Standalone.h"
//#include "XSource.h"
#include "XSingleSource.h"
#include "XWideSource.h"
#include "../../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
namespace XML
{
......@@ -23,15 +24,15 @@ namespace XML
XDeclaration();
public:
void fromSource(boost::shared_ptr<XSingleSource> source);
void fromSource(boost::shared_ptr<XWideSource> source);
void fromSource(NSCommon::smart_ptr<XSingleSource> source);
void fromSource(NSCommon::smart_ptr<XWideSource> source);
const std::string ToString() const;
const std::wstring ToWString() const;
public:
property<std::string, Limit::Version> Version;
property<std::string, Limit::Encoding> Encoding;
nullable_property<std::string, Limit::Standalone> Standalone;
property<std::string, Limit::Version> Version;
property<std::string, Limit::Encoding> Encoding;
nullable_property<std::string, Limit::Standalone> Standalone;
private:
void setValue(const std::string& name, const std::string& value);
......
......@@ -48,14 +48,16 @@ namespace XML
const bool XElementContainer::exist(const XName& xname) const
{
//for (const_iterator i = begin(); i != end(); ++i)
//{
for (std::list<XNode>::iterator i = m_container->begin(); i != m_container->end(); ++i)
if (m_container.IsInit())
{
if(i->isElement())
const std::list<XNode>& container = m_container.operator*();
for (std::list<XNode>::const_iterator i = container.begin(); i != container.end(); ++i)
{
if (XElement(*i)->XName == xname)
return true;
if(i->isElement())
{
if (XElement(*i)->XName == xname)
return true;
}
}
}
return false;
......@@ -63,8 +65,8 @@ namespace XML
XElement XElementContainer::operator[] (const XName& xname)
{
//for (iterator i = begin(); i != end(); ++i)
for (std::list<XNode>::iterator i = m_container->begin(); i != m_container->end(); ++i)
const std::list<XNode>& container = m_container.operator*();
for (std::list<XNode>::const_iterator i = container.begin(); i != container.end(); ++i)
{
if(i->isElement())
{
......@@ -72,8 +74,7 @@ namespace XML
return *i;
}
}
//for (iterator i = begin(); i != end(); ++i)
for (std::list<XNode>::iterator i = m_container->begin(); i != m_container->end(); ++i)
for (std::list<XNode>::const_iterator i = container.begin(); i != container.end(); ++i)
{
if(i->isElement())
{
......@@ -86,9 +87,8 @@ namespace XML
const XElement XElementContainer::operator[] (const XName& xname) const
{
//for (const_iterator i = begin(); i != end(); ++i)
//{
for (std::list<XNode>::iterator i = m_container->begin(); i != m_container->end(); ++i)
const std::list<XNode>& container = m_container.operator*();
for (std::list<XNode>::const_iterator i = container.begin(); i != container.end(); ++i)
{
if(i->isElement())
{
......@@ -96,9 +96,8 @@ namespace XML
return *i;
}
}
//for (const_iterator i = begin(); i != end(); ++i)
//{
for (std::list<XNode>::iterator i = m_container->begin(); i != m_container->end(); ++i)
for (std::list<XNode>::const_iterator i = container.begin(); i != container.end(); ++i)
{
if(i->isElement())
{
......@@ -106,6 +105,7 @@ namespace XML
return *i;
}
}
return nullXElement;
}
......
......@@ -2,12 +2,13 @@
#ifndef XML_PRIVATE_XELEMENT_CONTAINER_INCLUDE_H_
#define XML_PRIVATE_XELEMENT_CONTAINER_INCLUDE_H_
#include <boost/shared_ptr.hpp>
#include <list>
#include <boost/iterator/filter_iterator.hpp>
#include "Filter/Element.h"
#include "XNamespaceContainer.h"
#include "../../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
namespace XML
{
......@@ -36,7 +37,7 @@ namespace XML
public:
XElementContainer const* const operator->() const {return this;}
XElementContainer* operator->() {return this;}
XElementContainer* operator->() {return this;}
const bool exist(const XName& xname) const;
XElement operator[] (const XName& xname);
......@@ -54,7 +55,7 @@ namespace XML
const_iterator end() const;
private:
boost::shared_ptr<std::list<XNode> > m_container;
NSCommon::smart_ptr<std::list<XNode> > m_container;
};
} // namespace Private
......
......@@ -2,10 +2,10 @@
#ifndef XML_PRIVATE_XNAMESPACE_CONTAINER_INCLUDE_H_
#define XML_PRIVATE_XNAMESPACE_CONTAINER_INCLUDE_H_
#include "XContainer.h"
#include "./../XNamespace.h"
#include <string>
#include "XContainer.h"
#include "./../XNamespace.h"
namespace XML
{
......@@ -17,7 +17,7 @@ namespace XML
const bool exist(const std::string& name) const;
XNamespaceContainer const* const operator->() const {return this;}
XNamespaceContainer* operator->() {return this;}
XNamespaceContainer* operator->() {return this;}
XNamespace& operator[] (const std::string& name);
const XNamespace& operator[] (const std::string& name) const;
......
......@@ -77,7 +77,7 @@ namespace XML
}
}
const boost::shared_ptr<std::list<XNode> > XNodeContainer::container() const
const NSCommon::smart_ptr<std::list<XNode> > XNodeContainer::container() const
{
return m_container;
}
......
......@@ -3,9 +3,9 @@
#include <vector>
#include <string>
#include <boost/shared_ptr.hpp>
#include <list>
#include "../../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
namespace XML
{
......@@ -26,12 +26,9 @@ namespace XML
void merge(const XNodeContainer& other);
public:
//typedef std::vector<XNode>::iterator iterator;
//typedef std::vector<XNode>::const_iterator const_iterator;
typedef std::list<XNode>::iterator iterator;
typedef std::list<XNode>::const_iterator const_iterator;
public:
XNodeContainer const* const operator->() const {return this;}
XNodeContainer* operator->() {return this;}
......@@ -49,10 +46,10 @@ namespace XML
const_iterator end() const {return m_container->end();}
public:
const boost::shared_ptr<std::list<XNode> > container() const;
const NSCommon::smart_ptr<std::list<XNode> > container() const;
private:
boost::shared_ptr<std::list<XNode> > m_container;
NSCommon::smart_ptr<std::list<XNode> > m_container;
};
} // namespace Private
} // namespace XML
......
......@@ -2,7 +2,7 @@
#ifndef XML_PRIVATE_XPOINTER_INCLUDE_H_
#define XML_PRIVATE_XPOINTER_INCLUDE_H_
#include <boost/shared_ptr.hpp>
#include "../../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
namespace XML
{
......@@ -14,24 +14,27 @@ namespace XML
public:
XPointer() {}
XPointer(T* ptr) : m_ptr(ptr) {}
XPointer(const boost::shared_ptr<T>& ptr) : m_ptr(ptr) {}
XPointer(const NSCommon::smart_ptr<T>& ptr) : m_ptr(ptr) {}
template<class E>
XPointer(const XPointer<E>& rhs) : m_ptr(boost::dynamic_pointer_cast<T>(rhs.get_ptr())) {}
XPointer(const XPointer<E>& rhs)
{
m_ptr = rhs.get_ptr().smart_dynamic_cast<T>();
}
boost::shared_ptr<T> get_ptr() const {return m_ptr;}
NSCommon::smart_ptr<T> get_ptr() const {return m_ptr;}
public:
T const* const operator->() const {return m_ptr.get();}
T* operator->() {return m_ptr.get();}
T const* const operator->() const {return m_ptr.operator->();}
T* operator->() {return m_ptr.operator->();}
const T& operator*() const {return *m_ptr;}
T& operator*() {return *m_ptr;}
const T& operator*() const {return (m_ptr.operator*());}
T& operator*() {return (m_ptr.operator*());}
const bool is_init() const {return m_ptr != 0;}
const bool is_init() const {return m_ptr.is_init();}
protected:
boost::shared_ptr<T> m_ptr;
NSCommon::smart_ptr<T> m_ptr;
protected:
typedef XPointer<T> base;
......
......@@ -2,16 +2,14 @@
#ifndef XML_PRIVATE_XSINGLE_SOURCE_INCLUDE_H_
#define XML_PRIVATE_XSINGLE_SOURCE_INCLUDE_H_
//#include "XSource.h"
#include <iterator>
#include <string>
namespace XML
{
namespace Private
{
class XSingleSource// : public XSource
class XSingleSource
{
public:
virtual ~XSingleSource();
......
......@@ -2,7 +2,6 @@
#ifndef XML_PRIVATE_XSPACE_INCLUDE_H_
#define XML_PRIVATE_XSPACE_INCLUDE_H_
namespace XML
{
namespace Private
......
......@@ -7,24 +7,19 @@
#include "XNodeContainer.h"
#include "./../XText.h"
namespace XML
{
namespace Private
{
XTextContainer::XTextContainer(const XNodeContainer& nodes)
: m_container(nodes.container())
XTextContainer::XTextContainer(const XNodeContainer& nodes) : m_container(nodes.container())
{
}
const bool XTextContainer::empty() const
{
return size() == 0;
}
const size_t XTextContainer::size() const
{
size_t size = 0;
......@@ -33,7 +28,6 @@ namespace XML
return size;
}
void XTextContainer::push_back(const XText& text)
{
if (text.is_init())
......@@ -42,13 +36,11 @@ namespace XML
}
}
void XTextContainer::Add(const XML::XText& text)
{
push_back(text);
}
const XString XTextContainer::text() const
{
std::string text;
......@@ -59,30 +51,25 @@ namespace XML
return text.empty() ? XString() : text;
}
XTextContainer::iterator XTextContainer:: begin()
{
return iterator(m_container->begin(), m_container->end());
}
XTextContainer::iterator XTextContainer::end()
{
return iterator(m_container->end(), m_container->end());
}
XTextContainer::const_iterator XTextContainer::begin() const
{
return const_iterator(m_container->begin(), m_container->end());
}
XTextContainer::const_iterator XTextContainer::end() const
{
return const_iterator(m_container->end(), m_container->end());
}
} // namespace Private
} // namespace XML
\ No newline at end of file
......@@ -2,13 +2,13 @@
#ifndef XML_PRIVATE_XTEXT_CONTAINER_INCLUDE_H_
#define XML_PRIVATE_XTEXT_CONTAINER_INCLUDE_H_
#include <boost/shared_ptr.hpp>
//#include <vector>
#include <vector>
#include <list>
#include <boost/iterator/filter_iterator.hpp>
#include "Filter/Text.h"
#include "XString.h"
#include "../../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
namespace XML
{
......@@ -44,7 +44,7 @@ namespace XML
const_iterator end() const;
private:
boost::shared_ptr<std::list<XNode> > m_container;
NSCommon::smart_ptr<std::list<XNode> > m_container;
};
} // namespace Private
} // namespace XML
......
......@@ -2,16 +2,14 @@
#ifndef XML_PRIVATE_XWIDE_SOURCE_INCLUDE_H_
#define XML_PRIVATE_XWIDE_SOURCE_INCLUDE_H_
//#include "XSource.h"
#include <iterator>
#include <string>
namespace XML
{
namespace Private
{
class XWideSource //: public XSource
class XWideSource
{
public:
enum eSourceType {estLittleEndian, estBigEndian, estStringSource};
......@@ -48,7 +46,6 @@ namespace XML
protected:
std::istreambuf_iterator<wchar_t> m_iterator;
wchar_t m_current;
//bool m_littleEndian;
eSourceType m_SourceType;
};
} // namespace Private
......
......@@ -5,17 +5,13 @@
#include "XComment.h"
#include "XNode.h"
#include <boost/shared_ptr.hpp>
namespace XML
{
XComment::XComment(const XNode& xnode)
: base(boost::dynamic_pointer_cast<Private::Comment>(xnode.get_ptr())),
Value(m_ptr->Value)
: base(xnode.get_ptr().smart_dynamic_cast<Private::Comment>()),
Value(m_ptr->Value)
{
}
} // namespace XML
\ No newline at end of file
......@@ -9,58 +9,48 @@
#include "XText.h"
#include "Private/XList.h"
namespace XML
{
XContainer::XContainer()
: base(new Private::NodeContainer())
{
}
XContainer::XContainer(const XNode& xnode)
: base(boost::dynamic_pointer_cast<Private::NodeContainer>(xnode.get_ptr()))
: base(xnode.get_ptr().smart_dynamic_cast<Private::NodeContainer>())
{
}
XContainer::XContainer(const XElement& element)
: base(new Private::NodeContainer(element))
{
}
XContainer::XContainer(const XText& text)
: base(new Private::NodeContainer(text))
{
}
XContainer::XContainer(const Private::XList& list)
: base(new Private::NodeContainer(list))
{
}
void XContainer::Add(const XNode& node)
{
m_ptr->Add(node);
}
void XContainer::Add(const XElement& element)
{
m_ptr->Add(element);
}
void XContainer::Add(const XText& text)
{
m_ptr->Add(text);
}
void XContainer::Add(const Private::XList& list)
{
m_ptr->Add(list);
......
......@@ -27,17 +27,17 @@ namespace XML
TxtFile text(path);
if(text.isUnicode())
{
boost::shared_ptr<Private::XWideSource> xsource(new Private::XWFileSource(path, Private::XWideSource::estLittleEndian));
NSCommon::smart_ptr<Private::XWideSource> xsource(new Private::XWFileSource(path, Private::XWideSource::estLittleEndian));
Load(xsource, space);
}
else if((text.isBigEndian()) || (text.isUnicodeWithOutBOM()))
{
boost::shared_ptr<Private::XWideSource> xsource(new Private::XWFileSource(path, Private::XWideSource::estBigEndian));
NSCommon::smart_ptr<Private::XWideSource> xsource(new Private::XWFileSource(path, Private::XWideSource::estBigEndian));
Load(xsource, space);
}
else
{
boost::shared_ptr<Private::XSingleSource> xsource(new Private::XFileSource(path));
NSCommon::smart_ptr<Private::XSingleSource> xsource(new Private::XFileSource(path));
Load(xsource, space);
}
}
......@@ -45,14 +45,14 @@ namespace XML
XDocument::XDocument(const std::string& source, const bool space)
{
boost::shared_ptr<Private::XSingleSource> xsource(new Private::XStringSource(source));
NSCommon::smart_ptr<Private::XSingleSource> xsource(new Private::XStringSource(source));
Load(xsource, space);
}
XDocument::XDocument(const std::wstring& source, const bool space)
{
boost::shared_ptr<Private::XWideSource> xsource(new Private::XWStringSource(source));
NSCommon::smart_ptr<Private::XWideSource> xsource(new Private::XWStringSource(source));
Load(xsource, space);
}
......@@ -61,17 +61,17 @@ namespace XML
TxtFile text(source);
if(text.isUnicode())
{
boost::shared_ptr<Private::XWideSource> xsource(new Private::XWFileSource(source, Private::XWideSource::estLittleEndian));
NSCommon::smart_ptr<Private::XWideSource> xsource(new Private::XWFileSource(source, Private::XWideSource::estLittleEndian));
Load(xsource, space);
}
else if((text.isBigEndian()) || (text.isUnicodeWithOutBOM()))
{
boost::shared_ptr<Private::XWideSource> xsource(new Private::XWFileSource(source, Private::XWideSource::estBigEndian));
NSCommon::smart_ptr<Private::XWideSource> xsource(new Private::XWFileSource(source, Private::XWideSource::estBigEndian));
Load(xsource, space);
}
else
{
boost::shared_ptr<Private::XSingleSource> xsource(new Private::XFileSource(source));
NSCommon::smart_ptr<Private::XSingleSource> xsource(new Private::XFileSource(source));
Load(xsource, space);
}
}
......@@ -127,7 +127,7 @@ namespace XML
}
void XDocument::Load(boost::shared_ptr<Private::XSingleSource> source, const bool space)
void XDocument::Load(NSCommon::smart_ptr<Private::XSingleSource> source, const bool space)
{
source->findAndSkip('<');
if (source->get() == '?')
......@@ -140,7 +140,7 @@ namespace XML
}
void XDocument::Load(boost::shared_ptr<Private::XWideSource> source, const bool space)
void XDocument::Load(NSCommon::smart_ptr<Private::XWideSource> source, const bool space)
{
source->findAndSkip(L'<');
if (source->get() == L'?')
......
......@@ -7,9 +7,9 @@
#include "Private/XDeclaration.h"
#include "Private/XSingleSource.h"
#include "Private/XWideSource.h"
#include <boost/shared_ptr.hpp>
#include "../../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
#include "../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
namespace XML
{
......@@ -40,8 +40,8 @@ namespace XML
XElement Root;
private:
void Load(boost::shared_ptr<Private::XSingleSource> source, const bool space = false);
void Load(boost::shared_ptr<Private::XWideSource> source, const bool space = false);
void Load(NSCommon::smart_ptr<Private::XSingleSource> source, const bool space = false);
void Load(NSCommon::smart_ptr<Private::XWideSource> source, const bool space = false);
};
} // namespace XML
......
......@@ -13,16 +13,13 @@
#include "Private/XElementContainer.h"
#include "XNode.h"
#include "XText.h"
#include <boost/shared_ptr.hpp>
#include "Private/NullXElement.h"
#include "Private/NullElement.h"
#include "XAttribute.h"
#include "Exception/not_implement.h"
namespace XML
{
XElement::XElement()
: base(new Private::Element()),
XName(m_ptr->XName),
......@@ -35,7 +32,6 @@ namespace XML
{
}
XElement::XElement(const Private::NullXElement&)
: base(new Private::NullElement()),
XName(m_ptr->XName),
......@@ -48,7 +44,6 @@ namespace XML
{
}
XElement::XElement(const XML::XName& xname)
: base(new Private::Element(xname)),
XName(m_ptr->XName),
......@@ -61,7 +56,6 @@ namespace XML
{
}
XElement::XElement(const XML::XName& xname, const Private::XList& list)
: base(new Private::Element(xname, list)),
XName(m_ptr->XName),
......@@ -74,8 +68,7 @@ namespace XML
{
}
XElement::XElement(boost::shared_ptr<Private::XSingleSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space)
XElement::XElement(NSCommon::smart_ptr<Private::XSingleSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space)
: base(new Private::Element(source, ns, space)),
XName(m_ptr->XName),
Namespaces(m_ptr->Namespaces),
......@@ -87,8 +80,7 @@ namespace XML
{
}
XElement::XElement(boost::shared_ptr<Private::XWideSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space)
XElement::XElement(NSCommon::smart_ptr<Private::XWideSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space)
: base(new Private::Element(source, ns, space)),
XName(m_ptr->XName),
Namespaces(m_ptr->Namespaces),
......@@ -100,7 +92,6 @@ namespace XML
{
}
const XElement& XElement::operator =(const XElement& rhs)
{
m_ptr = rhs.m_ptr;
......@@ -114,17 +105,17 @@ namespace XML
return *this;
}
XElement::XElement(const XNode& xnode)
: base(boost::dynamic_pointer_cast<Private::Element>(xnode.get_ptr())),
XName(m_ptr->XName),
Namespaces(m_ptr->Namespaces),
Attributes(m_ptr->Attributes),
Nodes(m_ptr->Nodes),
Elements(m_ptr->Elements),
Texts(m_ptr->Texts),
Space(m_ptr->Space)
{
: base(xnode.get_ptr().smart_dynamic_cast<Private::Element>()),
XName(m_ptr->XName),
Namespaces(m_ptr->Namespaces),
Attributes(m_ptr->Attributes),
Nodes(m_ptr->Nodes),
Elements(m_ptr->Elements),
Texts(m_ptr->Texts),
Space(m_ptr->Space)
{
int c = 0;
}
void XElement::Save(const OOX::CPath& path) const
......@@ -132,109 +123,91 @@ namespace XML
XDocument(*this).Save(path);
}
void XElement::fromSource(boost::shared_ptr<Private::XSingleSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space)
void XElement::fromSource(NSCommon::smart_ptr<Private::XSingleSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space)
{
m_ptr->fromSource(source, ns, space);
}
void XElement::fromSource(boost::shared_ptr<Private::XWideSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space)
void XElement::fromSource(NSCommon::smart_ptr<Private::XWideSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space)
{
m_ptr->fromSource(source, ns, space);
}
const std::string XElement::ToString() const
{
return m_ptr->ToString();
}
const std::wstring XElement::ToWString() const
{
return m_ptr->ToWString();
}
void XElement::SaveToStringList(std::list<std::string>& strList)const
{
m_ptr->SaveToStringList(strList);
}
void XElement::SaveToWStringList(std::list<std::wstring>& strList)const
{
m_ptr->SaveToWStringList(strList);
}
const bool XElement::exist() const
{
return m_ptr->exist();
}
const Private::XNamespaceContainer XElement::usedNamespace() const
{
return m_ptr->usedNamespace();
}
const Private::XString XElement::text() const
{
return m_ptr->text();
}
void XElement::Add(const XAttribute& attribute)
{
m_ptr->Add(attribute);
}
void XElement::Add(const XNamespace& ns)
{
m_ptr->Add(ns);
}
void XElement::Add(const XNode& node)
{
m_ptr->Add(node);
}
void XElement::Add(const XElement& element)
{
m_ptr->Add(element);
}
void XElement::Add(const XText& text)
{
m_ptr->Add(text);
}
void XElement::Add(const XContainer& container)
{
m_ptr->Add(container);
}
void XElement::Add(const Private::XList& list)
{
m_ptr->Add(list);
}
XAttribute& XElement::attribute(const XML::XName& xname)
{
return m_ptr->attribute(xname);
}
const XAttribute& XElement::attribute(const XML::XName& xname) const
{
return m_ptr->attribute(xname);
......@@ -246,19 +219,16 @@ namespace XML
return m_ptr->element(xname);
}
const XElement XElement::element(const XML::XName& xname) const
{
return m_ptr->element(xname);
}
XElement XElement::element(const XML::XName& xname, const std::string& value)
{
return m_ptr->element(xname, value);
}
const XElement XElement::element(const XML::XName& xname, const std::string& value) const
{
return m_ptr->element(xname, value);
......
......@@ -3,19 +3,20 @@
#define XML_XELEMENT_INCLUDE_H_
#include <string>
#include <list>
#include "Private/XPointer.h"
#include "Private/Element.h"
#include "property.h"
#include "setter.h"
#include "getter.h"
#include <boost/shared_ptr.hpp>
#include "Private/XString.h"
#include "Private/XNamespaceContainer.h"
#include "Private/XSpace.h"
#include "Private/XSingleSource.h"
#include "Private/XWideSource.h"
#include <list>
#include "../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
namespace XML
{
......@@ -44,8 +45,8 @@ namespace XML
XElement(const Private::NullXElement&);
explicit XElement(const XName& xname);
XElement(const XName& xname, const Private::XList& list);
XElement(boost::shared_ptr<Private::XSingleSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space);
XElement(boost::shared_ptr<Private::XWideSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space);
XElement(NSCommon::smart_ptr<Private::XSingleSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space);
XElement(NSCommon::smart_ptr<Private::XWideSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space);
const XElement& operator= (const XElement& rhs);
XElement(const XNode& xnode);
......@@ -80,8 +81,8 @@ namespace XML
void Save(const OOX::CPath& path) const;
public:
void fromSource(boost::shared_ptr<Private::XSingleSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space);
void fromSource(boost::shared_ptr<Private::XWideSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space);
void fromSource(NSCommon::smart_ptr<Private::XSingleSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space);
void fromSource(NSCommon::smart_ptr<Private::XWideSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space);
const std::string ToString() const;
const std::wstring ToWString() const;
virtual void SaveToStringList(std::list<std::string>& strList)const;
......
......@@ -4,7 +4,6 @@
#include <boost/operators.hpp>
#include <string>
#include <boost/shared_ptr.hpp>
#include "property.h"
#include "nullable_property.h"
#include "XNamespace.h"
......
......@@ -5,17 +5,13 @@
#include "XText.h"
#include "XNode.h"
#include <boost/shared_ptr.hpp>
namespace XML
{
XText::XText(const XNode& xnode)
: base(boost::dynamic_pointer_cast<Private::Text>(xnode.get_ptr())),
Value(m_ptr->Value)
: base(xnode.get_ptr().smart_dynamic_cast<Private::Text>()),
Value(m_ptr->Value)
{
}
} // namespace XML
\ No newline at end of file
......@@ -8,11 +8,11 @@
#include <sstream>
#include <iterator>
#include <boost/shared_ptr.hpp>
#include <boost/operators.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/call_traits.hpp>
#include "../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
#include "setter.h"
#include "getter.h"
#include "nullable.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment