ircproxy  The Ultimate Cyborg

PersistXML.cc File Reference


Detailed Description

This file contains the implementation of class PersistXML.

Definition in file PersistXML.cc.

#include "sys.h"
#include <cassert>
#include <fstream>
#include <iterator>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include "debug.h"
#include "PersistXML.h"

Go to the source code of this file.

Functions

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


Function Documentation

bool valid_label ( std::string const &  label  ) 

Returns true if the label is valid.

Definition at line 93 of file PersistXML.cc.

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.