Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
#include <ExpatCoreParser.h>
|
typedef std::lock_guard< std::mutex > | lock_t |
|
|
static void | start (void *, const char *el, const char **attr) |
|
static void | end (void *, const char *el) |
|
static void | char_data (void *, const XML_Char *s, int len) |
|
static void | default_handler (void *, const XML_Char *s, int len) |
|
static void | comment (void *, const XML_Char *s) |
|
static int | external_entity (XML_Parser parser, const XML_Char *context, const XML_Char *, const XML_Char *systemId, const XML_Char *) |
|
static void | entity (void *userData, const XML_Char *entityName, int is_parameter_entity, const XML_Char *value, int value_length, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *) |
|
static const std::string & | find_external_entity (const std::string &name) |
|
static const std::string & | find_text_entity (const std::string &name) |
|
Definition at line 15 of file ExpatCoreParser.h.
◆ ExternalEntityMap
◆ lock_t
◆ ExpatCoreParser()
ExpatCoreParser::ExpatCoreParser |
( |
const std::string & |
prefix | ) |
|
|
private |
◆ char_data()
void ExpatCoreParser::char_data |
( |
void * |
user_data, |
|
|
const XML_Char * |
s, |
|
|
int |
len |
|
) |
| |
|
staticprivate |
◆ clean()
void ExpatCoreParser::clean |
( |
| ) |
|
|
private |
◆ comment()
void ExpatCoreParser::comment |
( |
void * |
user_data, |
|
|
const XML_Char * |
s |
|
) |
| |
|
staticprivate |
◆ default_handler()
void ExpatCoreParser::default_handler |
( |
void * |
user_data, |
|
|
const XML_Char * |
s, |
|
|
int |
len |
|
) |
| |
|
staticprivate |
◆ do_char_data()
void ExpatCoreParser::do_char_data |
( |
const XML_Char * |
s, |
|
|
int |
len |
|
) |
| |
|
private |
Definition at line 170 of file ExpatCoreParser.cxx.
171 if (len == 0)
return;
172 while ((len > 0) && (
s[len-1] ==
'\n')) len--;
173 if (len == 0)
return;
174 std::string temp (
s, len);
176 std::cout <<
"ExpatCoreParser::do_char_data> [" << temp <<
"]" << std::endl;
◆ do_comment()
void ExpatCoreParser::do_comment |
( |
const XML_Char * |
s | ) |
|
|
private |
Definition at line 192 of file ExpatCoreParser.cxx.
194 m_top = std::make_unique<CoreParser::DOMNode> ();
199 std::cout <<
"ExpatCoreParser::do_comment> s=" <<
s <<
" top=" <<
m_top.get() <<
" last=" <<
m_last <<
" node=" <<
node << std::endl;
◆ do_default_handler()
void ExpatCoreParser::do_default_handler |
( |
const XML_Char * |
s, |
|
|
int |
len |
|
) |
| |
|
private |
Definition at line 181 of file ExpatCoreParser.cxx.
182 if (len == 0)
return;
183 while ((len > 0) && (
s[len-1] ==
'\n')) len--;
184 if (len == 0)
return;
185 std::string temp (
s, len);
187 std::cout <<
"ExpatCoreParser::do_default_handler> [" << temp <<
"]" << std::endl;
◆ do_end()
void ExpatCoreParser::do_end |
( |
const char * |
el | ) |
|
|
private |
◆ do_external_entity()
int ExpatCoreParser::do_external_entity |
( |
XML_Parser |
parser, |
|
|
const XML_Char * |
context, |
|
|
const XML_Char * |
systemId |
|
) |
| |
|
private |
Definition at line 337 of file ExpatCoreParser.cxx.
339 std::string context_str;
340 if (context == 0) context_str =
"none";
341 else context_str = context;
346 if (replacement !=
"") {
348 std::cout <<
"ExpatCoreParser::do_external_entity> "
349 <<
" context=[" << context_str <<
"]"
350 <<
" replacement=[" << replacement <<
"]"
353 XML_Parser
p = XML_ExternalEntityParserCreate (
parser, context, NULL);
361 if (replacement ==
"NULL") {
364 if (replacement !=
"") {
369 std::cout <<
"ExpatCoreParser::do_external_entity> "
370 <<
" context=[" << context_str <<
"]"
372 <<
" replacement=[" << replacement <<
"]"
375 XML_Parser
p = XML_ExternalEntityParserCreate (
parser, context, NULL);
◆ do_start()
void ExpatCoreParser::do_start |
( |
const char * |
el, |
|
|
const char ** |
attr |
|
) |
| |
|
private |
Definition at line 142 of file ExpatCoreParser.cxx.
144 std::map <std::string, std::string>
a;
146 m_top = std::make_unique<CoreParser::DOMNode> ();
151 std::cout <<
"ExpatCoreParser::do_start> el=" <<
el <<
" top=" <<
m_top.get() <<
" last=" <<
m_last <<
" node=" <<
node << std::endl;
154 for (
i = 0; attr[
i];
i += 2) {
155 const char*
name = attr[
i];
156 const char*
value = attr[
i+1];
◆ end()
void ExpatCoreParser::end |
( |
void * |
user_data, |
|
|
const char * |
el |
|
) |
| |
|
staticprivate |
◆ entity()
void ExpatCoreParser::entity |
( |
void * |
userData, |
|
|
const XML_Char * |
entityName, |
|
|
int |
is_parameter_entity, |
|
|
const XML_Char * |
value, |
|
|
int |
value_length, |
|
|
const XML_Char * |
base, |
|
|
const XML_Char * |
systemId, |
|
|
const XML_Char * |
publicId, |
|
|
const XML_Char * |
|
|
) |
| |
|
staticprivate |
Definition at line 102 of file ExpatCoreParser.cxx.
113 if (!publicId) publicId =
"none";
114 std::string temp =
"none";
116 temp.assign (
value, strnlen(
value, value_length));
120 std::cout <<
"ExpatCoreParser::entity[" << 0 <<
"]> " << entityName;
121 std::cout <<
" is_parameter=" << is_parameter_entity;
122 std::cout <<
" value=[" << temp <<
"]";
123 std::cout <<
" base=[" <<
base <<
"]";
124 std::cout <<
" systemId=[" <<
systemId <<
"]";
125 std::cout <<
" publicId=[" << publicId <<
"]";
126 std::cout << std::endl;
◆ external_entity()
int ExpatCoreParser::external_entity |
( |
XML_Parser |
parser, |
|
|
const XML_Char * |
context, |
|
|
const XML_Char * |
, |
|
|
const XML_Char * |
systemId, |
|
|
const XML_Char * |
|
|
) |
| |
|
staticprivate |
◆ find_external_entity()
const std::string & ExpatCoreParser::find_external_entity |
( |
const std::string & |
name | ) |
|
|
staticprivate |
Definition at line 383 of file ExpatCoreParser.cxx.
385 ExternalEntityMap::const_iterator
it = s_entities.find (
name);
386 if (
it == s_entities.end ()) {
387 static const std::string
empty;
390 return ((*it).second);
◆ find_text_entity()
const std::string & ExpatCoreParser::find_text_entity |
( |
const std::string & |
name | ) |
|
|
staticprivate |
Definition at line 395 of file ExpatCoreParser.cxx.
397 ExternalEntityMap::const_iterator
it = s_text_entities.find (
name);
398 if (
it == s_text_entities.end ()) {
399 static const std::string
empty;
402 return ((*it).second);
◆ generic_parse()
int ExpatCoreParser::generic_parse |
( |
XML_Parser |
p, |
|
|
const std::string & |
file_name |
|
) |
| |
|
private |
Definition at line 207 of file ExpatCoreParser.cxx.
210 std::cout <<
"ExpatCoreParser::generic_parse> file_name=" <<
file_name <<
" prefix=" <<
m_prefix << std::endl;
214 docfd = fopen (temp_name.c_str (),
"r");
217 docfd = fopen (temp_name.c_str (),
"r");
221 const char* xmlpathenv =
::getenv (
"XMLPATH");
222 if (xmlpathenv == 0)
return (0);
223 std::string xmlpath = xmlpathenv;
224 std::string::size_type
pos = 0;
225 while (
pos != std::string::npos){
226 std::string::size_type
sep = xmlpath.find (
":",
pos);
227 if (
sep == std::string::npos){
228 temp_name = xmlpath.substr (
pos);
229 pos = std::string::npos;
231 temp_name = xmlpath.substr (
pos,
sep -
pos);
234 if (temp_name.empty())
continue;
235 std::string last_temp_name = temp_name;
239 std::cout <<
"ExpatCoreParser::generic_parse> file_name=" <<
file_name
240 <<
" xmlpath=" << xmlpath
241 <<
" temp_name=" << temp_name
245 docfd = fopen (temp_name.c_str (),
"r");
246 if (docfd != 0)
break;
249 temp_name = last_temp_name;
255 std::cout <<
"ExpatCoreParser::generic_parse> file_name=" <<
file_name
256 <<
" xmlpath=" << xmlpath
257 <<
" temp_name=" << temp_name
260 docfd = fopen (temp_name.c_str (),
"r");
261 if (docfd != 0)
break;
270 XML_SetParamEntityParsing (
p, XML_PARAM_ENTITY_PARSING_ALWAYS);
275 XML_SetUserData (
p,
this);
277 std::cout <<
"ExpatCoreParser::generic_parse> starting" << std::endl;
284 std::cout <<
"Read error" << std::endl;
288 int done = feof (docfd);
290 if (XML_ParseBuffer (
p,
BUFFSIZE, done) == XML_STATUS_ERROR) {
292 std::cout <<
"ExpatCoreParser::Parse error at line " << XML_GetCurrentLineNumber(
p)
295 << XML_ErrorString (XML_GetErrorCode(
p)) << std::endl;
◆ generic_text_parse()
int ExpatCoreParser::generic_text_parse |
( |
XML_Parser |
p, |
|
|
const std::string & |
text |
|
) |
| |
|
private |
Definition at line 307 of file ExpatCoreParser.cxx.
309 std::cout <<
"ExpatCoreParser::generic_text_parse> " << std::endl;
312 XML_SetParamEntityParsing (
p, XML_PARAM_ENTITY_PARSING_ALWAYS);
317 XML_SetUserData (
p,
this);
319 std::cout <<
"ExpatCoreParser::generic_text_parse> starting" << std::endl;
322 char*
buff = (
char*) XML_GetBuffer (
p,
text.size() + 1);
325 if (XML_ParseBuffer (
p,
text.size(), done) == XML_STATUS_ERROR) {
326 std::cout <<
"ExpatCoreParser::Parse error at line " << XML_GetCurrentLineNumber(
p)
328 << XML_ErrorString (XML_GetErrorCode(
p)) << std::endl;
◆ get_document()
◆ parse()
Definition at line 407 of file ExpatCoreParser.cxx.
411 if (
pos != std::string::npos){
416 XML_Parser
p = XML_ParserCreate (NULL);
418 std::cout <<
"ExpatCoreParser::Couldn't allocate memory for parser" << std::endl;
423 if (
result == 0)
return nullptr;
424 return me.get_document ();
◆ register_external_entity()
void ExpatCoreParser::register_external_entity |
( |
const std::string & |
name, |
|
|
const std::string & |
file_name |
|
) |
| |
|
static |
Definition at line 82 of file ExpatCoreParser.cxx.
84 std::cout <<
"ExpatCoreParser::register_external_entity> name=" <<
name
85 <<
" file_name=" <<
file_name << std::endl;
◆ register_text_entity()
void ExpatCoreParser::register_text_entity |
( |
const std::string & |
name, |
|
|
const std::string & |
text |
|
) |
| |
|
static |
◆ start()
void ExpatCoreParser::start |
( |
void * |
user_data, |
|
|
const char * |
el, |
|
|
const char ** |
attr |
|
) |
| |
|
staticprivate |
◆ ATLAS_THREAD_SAFE [1/2]
◆ ATLAS_THREAD_SAFE [2/2]
◆ m_last
◆ m_prefix
std::string ExpatCoreParser::m_prefix |
|
private |
◆ m_top
◆ s_mutex
std::mutex ExpatCoreParser::s_mutex |
|
staticprivate |
The documentation for this class was generated from the following files:
static int external_entity(XML_Parser parser, const XML_Char *context, const XML_Char *, const XML_Char *systemId, const XML_Char *)
static const std::string & find_external_entity(const std::string &name)
void do_end(const char *el)
int do_external_entity(XML_Parser parser, const XML_Char *context, const XML_Char *systemId)
static const std::string & find_text_entity(const std::string &name)
std::lock_guard< std::mutex > lock_t
void do_char_data(const XML_Char *s, int len)
static void end(void *, const char *el)
void do_comment(const XML_Char *s)
CoreParser::DOMNode * m_last
void do_default_handler(const XML_Char *s, int len)
int generic_parse(XML_Parser p, const std::string &file_name)
static void start(void *, const char *el, const char **attr)
static void char_data(void *, const XML_Char *s, int len)
void do_start(const char *el, const char **attr)
bool empty() const noexcept
std::string getenv(const std::string &variableName)
get an environment variable
int generic_text_parse(XML_Parser p, const std::string &text)
static std::mutex s_mutex
static void comment(void *, const XML_Char *s)
std::unique_ptr< CoreParser::DOMNode > m_top