mmx::xml Namespace Reference

Namespace for parsing and printing in xml format. More...

Functions


Detailed Description

Namespace for parsing and printing in xml format.


Function Documentation

OSTREAM& mmx::xml::print ( OSTREAM &  os,
const upoldse< C, R > &  p 
) [inline]

Print a univariate polynomial, with its polynomial tags.

Definition at line 145 of file xml.hpp.

References print().

00146   {
00147     xml::print(os,p,"polynomial");
00148     return os;
00149   }

OSTREAM & print ( OSTREAM &  os,
const X &  x,
const char *  tag 
) [inline]

Definition at line 34 of file xml.hpp.

Referenced by print(), and mmx::run_solver().

00035   {
00036     os<<"<"<<tag<<">"<<x<<"</"<<tag<<">";
00037     return os;
00038   }

bool mmx::xml::read ( ISTREAM &  is,
upoldse< C, R > &  p 
) [inline]

Read a univariate polynomial, enclosed in polynomial tags.

Definition at line 138 of file xml.hpp.

References read_upol().

00139   {
00140     return read_upol(is,p);
00141   }

bool mmx::xml::read ( ISTREAM &  is,
polynomial< C, R > &  p,
variables &  V 
) [inline]

Read a polynomial, enclosed in polynomial tags.

Definition at line 41 of file polynomial_xml.hpp.

References begin_polynomial, and skip().

Referenced by mmx::run_solver().

00041                                                         {
00042       if(skip(is,begin_polynomial)) {
00043         std::string s; char c;
00044         while((c=is.get()) != EOF && c != '<') {
00045           if(c != ' ' && c != '\n') s+=c;
00046         }
00047         s+='\0';
00048         p = polynomial<C,R>(s.data(),V);
00049         return true;
00050       } else {
00051         p=polynomial<C,R>(0); return false;
00052       }
00053     }

bool mmx::xml::read_pol ( ISTREAM &  is,
T &  p,
const VAR &  V 
) [inline]

Read a polynomial, enclosed in polynomial tags.

Definition at line 88 of file xml.hpp.

References begin_polynomial, and skip().

00089   {
00090     if(skip(is,begin_polynomial))
00091       {
00092         std::string s; char c;
00093         while((c=is.get()) != EOF && c != '<') 
00094           {
00095             if(c != ' ' && c != '\n') s+=c;
00096           }
00097         s+='\0';
00098         p = T(s.data(),V);
00099         return true;
00100       }
00101     else 
00102       {
00103         p=T(0); return false;
00104       }
00105   }

bool mmx::xml::read_pol ( ISTREAM &  is,
T &  p 
) [inline]

Read a polynomial, enclosed in polynomial tags.

Definition at line 66 of file xml.hpp.

References begin_polynomial, and skip().

00067   {
00068     if(skip(is,begin_polynomial))
00069       {
00070         ::std::string s; char c;
00071         while((c=is.get()) != EOF && c != '<') 
00072           {
00073             if(c != ' ' && c != '\n') s+=c;
00074           }
00075         s+='\0';
00076         //PRINT_DEBUG(s.data());
00077         p = T(s.data());
00078         return true;
00079       }
00080     else 
00081       {
00082         p=T(0); return false;
00083       }
00084   }

std::string mmx::xml::read_tag ( ISTREAM &  is,
const char *  tag 
) [inline]

Read between tag and "<" and build p from this string;.

Definition at line 47 of file xml.hpp.

References skip().

00048   {
00049     if(skip(is,tag))
00050       {
00051         std::string s; char c;
00052         while((c=is.get()) != EOF && c != '<') 
00053           {
00054             if(c != '\n') s+=c;
00055           }
00056         //      s+='\0';
00057         return s;
00058       }
00059     else
00060       {
00061         return std::string("");
00062       }
00063   }

bool mmx::xml::read_upol ( ISTREAM &  is,
T &  p 
) [inline]

Read a polynomial, enclosed in polynomial tags.

Definition at line 117 of file xml.hpp.

References begin_polynomial, and skip().

Referenced by read().

00118   {
00119     if(skip(is,begin_polynomial))
00120       {
00121         std::string s; char c;
00122         while((c=is.get()) != EOF && c != '<') 
00123           {
00124             if(c != ' ' && c != '\n') s+=c;
00125           }
00126         s+='\0';
00127         p = T(s.data());
00128         return true;
00129       }
00130     else 
00131       {
00132         p=T(0); return false;
00133       }
00134   }

bool skip ( ISTREAM &  is,
const char *  s 
) [inline]

Skip the input stream until s is found. It returns true if s is found.

Definition at line 18 of file xml.hpp.

Referenced by read(), read_pol(), read_tag(), read_upol(), and sread().

00019   {
00020     char c=(*s); const char* t=s;
00021     unsigned n= strlen(s),i=0;    
00022     while(c != EOF)
00023       {
00024         for(i=0; i<n && (c !=EOF) && (c=is.get()) == (*t); i++,t++);
00025         if(i==n) 
00026           return true;
00027         else 
00028           t=s;
00029       }
00030     return false;
00031   }

bool mmx::xml::sread ( ISTREAM &  is,
std::string &  s 
) [inline]

Read a polynomial as a string, enclosed in polynomial tags.

Definition at line 57 of file polynomial_xml.hpp.

References begin_polynomial, and skip().

00057                                      {
00058       if(skip(is,begin_polynomial)) {
00059         char c;
00060         while((c=is.get()) != EOF && c != '<') {
00061           if(c != ' ' && c != '\n') s+=c;
00062         }
00063         s+='\0';
00064         return true;
00065       } else {
00066         return false;
00067       }
00068     }


Generated on 6 Dec 2012 for realroot by  doxygen 1.6.1