5 #include "UnicodeString.h"
7 namespace Poco { class SharedMemory; }
13 typedef std::map<std::string, std::string> EntityMap;
14 static void Load(EntityMap &entityMap);
15 static std::string Resolve(const EntityMap &, const std::string& v);
16 static std::string Entities(const std::string& v);
17 void Load(EntityMap &entityMap, int dummy = 0);
20 const char *first; // first char of current markup (valid after Move)
21 const char *lower; // beginning of enclosed text (valid after Move)
22 const char *upper; // end of enclosed text (initially beginning of file)
23 const char *ahead; // last char of file
27 HtmlUTags = 0x20, // check for unbalanced tags
28 Html = IgnoreCase|HtmlUTags // shortcut
30 CMarkdown(const char *upper, const char *ahead, unsigned flags = 0);
31 operator bool(); // is node ahead?
32 void Scan(); // find closing tag
33 CMarkdown &Move(); // move to next node
34 CMarkdown &Move(const char *); // move to next node with given name
35 bool Pull(); // pull child nodes into view
36 CMarkdown &Pop(); // irreversible pull for chained calls
37 bool Push(); // reverse pull
38 std::string GetTagName() const; // tag name
39 std::string GetTagText() const; // tag name plus attributes
40 std::string GetInnerText(); // text between enclosing tags
41 std::string GetOuterText(); // text including enclosing tags
42 std::string GetAttribute(const char *, std::string * = 0); // random or enumerate
44 int (*const memcmp)(const void *, const void *, size_t);
45 const char *const utags;
46 size_t FindTag(const char *, const char *) const;
50 class CMarkdown::FileImage
52 // Map a file into process memory. Optionally convert UCS2 source to UTF8.
63 Poco::SharedMemory *m_pSharedMemory;
64 explicit FileImage(const TCHAR *, size_t trunc = 0, unsigned flags = 0);
65 FileImage(const FileImage& other) = delete;
67 static int GuessByteOrder(unsigned);
70 class CMarkdown::File : public CMarkdown::FileImage, public CMarkdown
72 // Construct CMarkdown object from file.
74 explicit File(const TCHAR * path, size_t trunc = 0, unsigned flags = Octets):
75 CMarkdown::FileImage(path, trunc, flags),
76 CMarkdown((const char *)pImage, (const char *)pImage + cbImage, flags)