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

удалил

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@53794 954022d7-b5bf-4e40-9824-e11837661b57
parent 8c7afb37
#pragma once
#ifndef XML_FILL_FROM_ATTRIBUTE_INCLUDE_H_
#define XML_FILL_FROM_ATTRIBUTE_INCLUDE_H_
#include "property.h"
#include "./../XML.h"
#include <boost/call_traits.hpp>
namespace XML
{
template<class T, typename V>
void FillFromAttribute(T& container, const XML::XElement& element, const XML::XName& xname, typename boost::call_traits<V>::param_type value)
{
for (XML::const_element_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
{
XElement element(*i);
if (element.attribute(xname).exist() && element.attribute(name).value() == value)
{
container.push_back(T::value_type(XElement(*i)));
container.back().this_is_not_xobject_class();
}
}
}
template<class T, typename V>
void FillFromAttribute(property<T>& container, const XML::XElement& element, const XML::XName& xname, typename boost::call_traits<V>::param_type value)
{
for (XML::const_element_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
{
XElement element(*i);
if (element.attribute(name).exist() && element.attribute(name).value() == value)
{
container.push_back(T::value_type(XElement(*i)));
container.back().this_is_not_xobject_class();
}
}
}
} // namespace XML
#endif // XML_FILL_FROM_ATTRIBUTE_INCLUDE_H_
\ No newline at end of file
// auto inserted precompiled begin
#include "precompiled_xml.h"
// auto inserted precompiled end
#include "Write.h"
#include "./../XObject.h"
#include "./../XElement.h"
namespace XML
{
const XNode Write(const XObject& object)
{
return object.toXML();
}
}
\ No newline at end of file
#pragma once
#ifndef XML_EXTENSION_WRITE_INCLUDE_H_
#define XML_EXTENSION_WRITE_INCLUDE_H_
#include "nullable.h"
#include "property.h"
#include "nullable_property.h"
#include <boost/shared_ptr.hpp>
#include "./../XNode.h"
#include "./../XName.h"
#include <boost/call_traits.hpp>
#include <boost/foreach.hpp>
namespace XML
{
class XObject;
const XNode Write(const XObject& object);
template<class O, typename T>
const XNode Write(const O& object, const T& value)
{
return object.toXML(value);
}
template<class T>
const XNode Write(const nullable<T>& object)
{
if (object.is_init())
{
object->this_is_not_xobject_class();
return object->toXML();
}
return XNode();
}
template<class T, class S, class G>
const XNode Write(const property<T, S, G>& object)
{
object->this_is_not_xobject_class();
return object->toXML();
}
template<class T, class S, class G, typename V>
const XNode Write(const property<T, S, G>& object, const V& value)
{
object->this_is_not_xobject_class();
return object->toXML(value);
}
template<class T, class S, class G>
const XNode Write(const nullable_property<T, S, G>& object)
{
if (object.is_init())
{
object->this_is_not_xobject_class();
return object->toXML();
}
return XNode();
}
template<class T, class S, class G, typename V>
const XNode Write(const nullable_property<T, G, S>& object, const V& value)
{
if (object.is_init())
{
object->this_is_not_xobject_class();
return object->toXML(value);
}
return XNode();
}
template<class T>
const XNode Write(T* object)
{
if (object != 0)
{
object->this_is_not_xobject_class();
return object->toXML();
}
return XNode();
}
template<class T, typename V>
const XNode Write(T* object, const V& value)
{
if (object != 0)
{
object->this_is_not_xobject_class();
return object->toXML(value);
}
return XNode();
}
template<class T>
const XNode Write(const boost::shared_ptr<T>& object)
{
if (object != 0)
{
object->this_is_not_xobject_class();
return object->toXML();
}
return XNode();
}
template<class T, typename V>
const XNode Write(const boost::shared_ptr<T>& object, const V& value)
{
if (object != 0)
{
object->this_is_not_xobject_class();
return object->toXML(value);
}
return XNode();
}
template<template<typename T, class A> class C, typename T, class A>
const XNode Write(const C<T, A>& container)
{
return XContainer(container);
}
template<template<typename T, class A> class C, typename T, class A, typename V>
const XNode Write(const C<T, A>& container, const V& value)
{
XContainer xcontainer;
BOOST_FOREACH(const T& object, container)
{
xcontainer.Add(object.toXML(value));
}
return xcontainer;
}
template<template<typename T, class A> class C, typename T, class A>
const XNode Write(const property<C<T, A> >& container)
{
return XContainer(container);
}
template<template<typename T, class A> class C, typename T, class A, typename V>
const XNode Write(const property<C<T, A> >& container, const V& value)
{
XContainer xcontainer;
BOOST_FOREACH(const T& object, *container)
{
xcontainer.Add(object.toXML(value));
}
return xcontainer;
}
template<typename T>
const XML::XNode Write(const XML::XName& element, const XML::XName& attribute, const T& value)
{
return XML::XElement(element, XML::XAttribute(attribute, value));
}
template<typename T>
const XML::XNode Write(const XML::XName& element, const XML::XName& attribute, const nullable<T>& value)
{
if (value.is_init())
return XML::XElement(element, XML::XAttribute(attribute, *value));
return XML::XNode();
}
template<typename T, class S, class G>
const XML::XNode Write(const XML::XName& element, const XML::XName& attribute, const property<T, S, G>& value)
{
return XML::XElement(element, XML::XAttribute(attribute, value));
}
template<typename T, class S, class G>
const XML::XNode Write(const XML::XName& element, const XML::XName& attribute, const nullable_property<T, S, G>& value)
{
if (value.is_init())
return XML::XElement(element, XML::XAttribute(attribute, value));
return XML::XNode();
}
} // namespace XML
#endif // XMK_EXTENSION_WRITE_INCLUDE_H_
\ No newline at end of file
// auto inserted precompiled begin
#include "precompiled_xml.h"
// auto inserted precompiled end
#include "WriteIf.h"
namespace XML
{
const XML::XNode WriteIf(const XName& xname, const bool write)
{
if (write)
return XML::XElement(xname);
return XML::XNode();
}
const XML::XNode WriteIf(const XName& xname, const nullable<bool> write)
{
if (write.get_value_or(false))
return XML::XElement(xname);
return XML::XNode();
}
const XML::XNode WriteIf(const XName& xname, const property<bool> write)
{
if (write)
return XML::XElement(xname);
return XML::XNode();
}
const XML::XNode WriteIf(const XName& xname, const nullable_property<bool> write)
{
if (write.get_value_or(false))
return XML::XElement(xname);
return XML::XNode();
}
const XML::XNode WriteIf(const XML::XElement& element, const bool write)
{
if (write)
return element;
return XML::XNode();
}
const XML::XNode WriteIf(const XML::XElement& element, const nullable<bool> write)
{
if (write.get_value_or(false))
return element;
return XML::XNode();
}
const XML::XNode WriteIf(const XML::XElement& element, const property<bool> write)
{
if (write)
return element;
return XML::XNode();
}
const XML::XNode WriteIf(const XML::XElement& element, const nullable_property<bool> write)
{
if (write.get_value_or(false))
return element;
return XML::XNode();
}
const XML::XNode WriteIf(const XML::XNode& node, const bool write)
{
if (write)
return node;
return XML::XNode();
}
const XML::XNode WriteIf(const XML::XNode& node, const nullable<bool> write)
{
if (write.get_value_or(write))
return node;
return XML::XNode();
}
const XML::XNode WriteIf(const XML::XNode& node, const property<bool> write)
{
if (write)
return node;
return XML::XNode();
}
const XML::XNode WriteIf(const XML::XNode& node, const nullable_property<bool> write)
{
if (write.get_value_or(false))
return node;
return XML::XNode();
}
const XML::XAttribute WriteIf(const XML::XAttribute& attribute, const bool write)
{
if (write)
return attribute;
return XML::XAttribute();
}
const XML::XAttribute WriteIf(const XML::XAttribute& attribute, const nullable<bool> write)
{
if (write.get_value_or(false))
return attribute;
return XML::XAttribute();
}
const XML::XAttribute WriteIf(const XML::XAttribute& attribute, const property<bool> write)
{
if (write)
return attribute;
return XML::XAttribute();
}
const XML::XAttribute WriteIf(const XML::XAttribute& attribute, const nullable_property<bool> write)
{
if (write.get_value_or(false))
return attribute;
return XML::XAttribute();
}
} // namespace XML
\ No newline at end of file
#pragma once
#ifndef XML_EXTENSION_WRITE_IF_INCLUDE_H_
#define XML_EXTENSION_WRITE_IF_INCLUDE_H_
#include "nullable.h"
#include "property.h"
#include "nullable_property.h"
#include "./../XName.h"
#include "./../XNode.h"
#include "./../XElement.h"
#include "./../XAttribute.h"
namespace XML
{
const XML::XNode WriteIf(const XName& xname, const bool write);
const XML::XNode WriteIf(const XName& xname, const nullable<bool> write);
const XML::XNode WriteIf(const XName& xname, const property<bool> write);
const XML::XNode WriteIf(const XName& xname, const nullable_property<bool> write);
const XML::XNode WriteIf(const XML::XElement& element, const bool write);
const XML::XNode WriteIf(const XML::XElement& element, const nullable<bool> write);
const XML::XNode WriteIf(const XML::XElement& element, const property<bool> write);
const XML::XNode WriteIf(const XML::XElement& element, const nullable_property<bool> write);
const XML::XNode WriteIf(const XML::XNode& node, const bool write);
const XML::XNode WriteIf(const XML::XNode& node, const nullable<bool> write);
const XML::XNode WriteIf(const XML::XNode& node, const property<bool> write);
const XML::XNode WriteIf(const XML::XNode& node, const nullable_property<bool> write);
const XML::XAttribute WriteIf(const XML::XAttribute& attribute, const bool write);
const XML::XAttribute WriteIf(const XML::XAttribute& attribute, const nullable<bool> write);
const XML::XAttribute WriteIf(const XML::XAttribute& attribute, const property<bool> write);
const XML::XAttribute WriteIf(const XML::XAttribute& attribute, const nullable_property<bool> write);
} // namespace XML
#endif // XML_EXTENSION_WRITE_IF_INCLUDE_H_
\ No newline at end of file
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