/** @file * @author Edouard DUPIN * * @copyright 2011, Edouard DUPIN, all right reserved * * @license APACHE v2.0 (see license file) */ #pragma once #include #include namespace exml { namespace internal { /** * @brief Text node interface (internal data between two balise : <XXX> ALL here </XXX> */ class Text : public exml::internal::Node { protected: /** * @brief Constructor */ Text() { }; /** * @brief Constructor * @param[in] _data String data of the current Text */ Text(const std::string& _data) : exml::internal::Node(_data) { }; public: /** * @brief defined factory * @param[in] _data Data in the Text area * @return Shared pointer on the Text element */ static ememory::SharedPtr create(const std::string& _data=""); /** * @brief count the number of line in the current text * @return The number of lines */ int32_t countLines() const; public: enum nodeType getType() const override{ return nodeType::text; }; bool iParse(const std::string& _data, int32_t& _pos, bool _caseSensitive, exml::FilePos& _filePos, exml::internal::Document& _doc) override; bool iGenerate(std::string& _data, int32_t _indent) const override; ememory::SharedPtr toText() override { return std::static_pointer_cast(shared_from_this()); }; ememory::SharedPtr toText() const override { return std::static_pointer_cast(shared_from_this()); }; }; /** * @brief Text node interface for balise CDATA <![CDATA[*******]]> */ class TextCDATA : public exml::internal::Text { protected: /** * @brief Constructor */ TextCDATA() { }; public: /** * @brief defined factory * @return Shared pointer on the Text CDATA element */ static ememory::SharedPtr create(); public: bool iParse(const std::string& _data, int32_t& _pos, bool _caseSensitive, exml::FilePos& _filePos, exml::internal::Document& _doc) override; bool iGenerate(std::string& _data, int32_t _indent) const override; }; } }