ircproxy  The Ultimate Cyborg

PersistXML.h File Reference

Detailed Description

This file contains the declaration of class PersistXML.

Definition in file PersistXML.h.

#include <string>
#include <fstream>
#include <stdexcept>
#include <vector>
#include <list>
#include <stack>
#include <sstream>
#include <libxml/parser.h>
#include <boost/shared_ptr.hpp>
#include <boost/optional/optional.hpp>
#include "debug.h"
#include "exceptions.h"

Go to the source code of this file.


class  xml_invalid_label
 Exception class used to signal an invalid XML label. More...
class  xml_parse_error
 Exception class used to signal a failure in parsing an XML document. More...
class  Indentation
 A class to control output indentation. More...
class  PersistXML
 A persistent object archiver. More...
class  XMLLabel
 An XML label. More...




bool valid_label (std::string const &label)
 Returns true if the label is valid.

Define Documentation

#define SERIALIZE_BUILTINTYPE ( type   ) 


template<> inline void PersistXML::serialize(std::string const& label, type& builtin) \
    { this->serialize_builtin(label, builtin); }

For internal use only.

Helper macro to define serialization specializations for the builtin types.

Definition at line 467 of file PersistXML.h.

Function Documentation

bool valid_label ( std::string const &  label  ) 

Returns true if the label is valid.

Definition at line 93 of file

Referenced by PersistXML::serialize().

00094 {
00095   if (label.size() == 0)
00096     return false;
00097   char first_char = label[0];
00098   if (first_char != '_' && !std::isalpha(first_char))
00099     return false;
00100   if (label.size() >= 3 &&
00101       std::tolower(first_char) == 'x' &&
00102       std::tolower(label[1]) == 'm' &&
00103       std::tolower(label[2]) == 'l')
00104     return false;
00105   std::string::const_iterator iter = label.begin();
00106   while (++iter != label.end())
00107   {
00108     char next_character = *iter;
00109     if (!std::isalpha(next_character) && !std::isdigit(next_character) && !std::ispunct(next_character))
00110       return false;
00111   }
00112   return true;
00113 }

Copyright © 2005-2007 Carlo Wood.  All rights reserved.