Commit 2e67aa54 authored by Davis King's avatar Davis King

Turned the xml_parser into a single implementation component.

parent f9e63c9d
......@@ -7,51 +7,7 @@
#include "xml_parser/xml_parser_kernel_interfaces.h"
#include "xml_parser/xml_parser_kernel_1.h"
#include "xml_parser/xml_parser_kernel_c.h"
#include "map.h"
#include "stack.h"
#include "sequence.h"
#include "memory_manager.h"
namespace dlib
{
class xml_parser
{
typedef map<std::string,std::string,memory_manager<char>::kernel_2a>::kernel_1b map1a;
typedef map<std::string,std::string,memory_manager<char>::kernel_2a>::kernel_1b_c map1a_c;
typedef stack<std::string,memory_manager<char>::kernel_2a>::kernel_1a stack1a;
typedef sequence<document_handler*>::kernel_2a seq_dh2a;
typedef sequence<error_handler*>::kernel_2a seq_eh2a;
// A version that uses the checked map. This way there is checking on the attribute
// list that gets passed back to the user.
typedef xml_parser_kernel_1<map1a_c,stack1a,seq_dh2a,seq_eh2a>
kernel_1a_c_impl;
xml_parser() {}
public:
//----------- kernels ---------------
// kernel_1a
typedef xml_parser_kernel_1<map1a,stack1a,seq_dh2a,seq_eh2a>
kernel_1a;
typedef xml_parser_kernel_c<kernel_1a_c_impl>
kernel_1a_c;
};
}
#endif // DLIB_XML_PARSEr_
This diff is collapsed.
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_XML_PARSER_KERNEL_C_
#define DLIB_XML_PARSER_KERNEL_C_
#include "xml_parser_kernel_abstract.h"
#include <string>
#include <iostream>
#include "../algs.h"
#include "../assert.h"
namespace dlib
{
template <
typename xml_parser_base
>
class xml_parser_kernel_c : public xml_parser_base
{
public:
void parse (
std::istream& in
);
};
template <
typename xml_parser_base
>
inline void swap (
xml_parser_kernel_c<xml_parser_base>& a,
xml_parser_kernel_c<xml_parser_base>& b
) { a.swap(b); }
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// member function definitions
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template <
typename xml_parser_base
>
void xml_parser_kernel_c<xml_parser_base>::
parse (
std::istream& in
)
{
DLIB_CASSERT ( in.fail() == false ,
"\tvoid xml_parser::parse"
<< "\n\tthe input stream must not be in the fail state"
<< "\n\tthis: " << this
);
return xml_parser_base::parse(in);
}
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_XML_PARSER_KERNEL_C_
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