|
realroot_doc 0.1.1
|
Namespace for parsing and printing in @ format. More...
Namespace for parsing and printing in @ format.
| OSTREAM & print | ( | OSTREAM & | os, |
| const X & | x, | ||
| const char * | tag | ||
| ) |
Definition at line 16 of file polynomial_xml.hpp.
Referenced by print(), and mmx::run_solver().
{
os<<"<"<<tag<<">"<<x<<"</"<<tag<<">";
return os;
}
| OSTREAM& mmx::xml::print | ( | OSTREAM & | os, |
| const upoldse< C, R > & | p | ||
| ) |
Print a univariate polynomial, with its @ tags.
Definition at line 145 of file xml.hpp.
References print().
{
xml::print(os,p,"polynomial");
return os;
}
| bool mmx::xml::read | ( | ISTREAM & | is, |
| upoldse< C, R > & | p | ||
| ) |
Read a univariate polynomial, enclosed in @ tags.
Definition at line 138 of file xml.hpp.
References read_upol().
{
return read_upol(is,p);
}
| bool mmx::xml::read | ( | ISTREAM & | is, |
| polynomial< C, R > & | p, | ||
| variables & | V | ||
| ) |
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().
{
if(skip(is,begin_polynomial)) {
std::string s; char c;
while((c=is.get()) != EOF && c != '<') {
if(c != ' ' && c != '\n') s+=c;
}
s+='\0';
p = polynomial<C,R>(s.data(),V);
return true;
} else {
p=polynomial<C,R>(0); return false;
}
}
| bool mmx::xml::read_pol | ( | ISTREAM & | is, |
| T & | p, | ||
| const VAR & | V | ||
| ) |
Read a polynomial, enclosed in @ tags.
Definition at line 88 of file xml.hpp.
References begin_polynomial, and skip().
{
if(skip(is,begin_polynomial))
{
std::string s; char c;
while((c=is.get()) != EOF && c != '<')
{
if(c != ' ' && c != '\n') s+=c;
}
s+='\0';
p = T(s.data(),V);
return true;
}
else
{
p=T(0); return false;
}
}
| bool mmx::xml::read_pol | ( | ISTREAM & | is, |
| T & | p | ||
| ) |
Read a polynomial, enclosed in @ tags.
Definition at line 66 of file xml.hpp.
References begin_polynomial, and skip().
{
if(skip(is,begin_polynomial))
{
::std::string s; char c;
while((c=is.get()) != EOF && c != '<')
{
if(c != ' ' && c != '\n') s+=c;
}
s+='\0';
//PRINT_DEBUG(s.data());
p = T(s.data());
return true;
}
else
{
p=T(0); return false;
}
}
| std::string mmx::xml::read_tag | ( | ISTREAM & | is, |
| const char * | tag | ||
| ) |
| bool mmx::xml::read_upol | ( | ISTREAM & | is, |
| T & | p | ||
| ) |
Read a polynomial, enclosed in @ tags.
Definition at line 117 of file xml.hpp.
References begin_polynomial, and skip().
Referenced by read().
{
if(skip(is,begin_polynomial))
{
std::string s; char c;
while((c=is.get()) != EOF && c != '<')
{
if(c != ' ' && c != '\n') s+=c;
}
s+='\0';
p = T(s.data());
return true;
}
else
{
p=T(0); return false;
}
}
| bool skip | ( | ISTREAM & | is, |
| const char * | s | ||
| ) |
Skip the input stream until s is found. It returns true if @ is found.
Definition at line 23 of file polynomial_xml.hpp.
Referenced by read(), read_pol(), read_tag(), read_upol(), and sread().
{
char c=(*s); const char* t=s;
unsigned n= strlen(s),i=0;
while(c != EOF) {
for(i=0; i<n && (c !=EOF) && (c=is.get()) == (*t); i++,t++);
if(i==n) {
while((c=is.get()) != EOF && c != '>') ;
return true;
}
else
t=s;
}
return false;
}
| bool mmx::xml::sread | ( | ISTREAM & | is, |
| std::string & | s | ||
| ) |
Read a polynomial as a string, enclosed in polynomial tags.
Definition at line 57 of file polynomial_xml.hpp.
References begin_polynomial, and skip().
{
if(skip(is,begin_polynomial)) {
char c;
while((c=is.get()) != EOF && c != '<') {
if(c != ' ' && c != '\n') s+=c;
}
s+='\0';
return true;
} else {
return false;
}
}