| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
TeAsciiFile Class Reference

A class for handling reading/writing for ASCII files. More...

`#include <TeAsciiFile.h>`

Inheritance diagram for TeAsciiFile:

List of all members.

## Public Member Functions

| TeAsciiFile (const string &name, const char *mode="r")
| Contructors.
virtual | ~TeAsciiFile ()
| Destructor.
void | writeNewLine ()
| Writes a carriage return character.
void | findNewLine ()
| Goes to a new line.
string | readString ()
| Reads a string.
string | readLine ()
| Reads a full line up to carriage return.
void | writeString (const string &s)
| Writes a generic string to the file.
string | readQuotedString ()
| Reads a string whithin quotes.
string | readStringCSV (const char sep= ',', bool skip=false, const char skip_char= ' ')
| Reads a comma-separated string ( with a skip character )
char | readQuotedChar ()
| Reads a character whithin quotes.
char | readChar ()
| Reads a character.
string | readStringCSVNoSpace (const char del= ',')
| Reads a comma-separated string(ignore spaces)
string | readStringCSVNoQuote (const char del= ',')
| Reads a comma-separated string (ignore quote )
int | readInt ()
| Reads an integer.
int | readIntCSV (const char del= ',')
| Reads a comma-separated int.
double | readFloat ()
| Reads a float.
double | readFloatCSV (const char del= ',')
| Reads a comma-separated float.
TeCoord2D | readCoord2D ()
| Reads a 2D coordinate ( x, y )
void | readStringList (vector< string > &)
| Reads a line and put in a stringlist.
void | readStringListCSV (vector< string > &, const char sep= ',')
| Reads a comma-separated line string and put in a string list.
void | readNStringCSV (vector< string > &, unsigned int n, const char sep= ',')
| Reads the first n strings from a comma separated line string and put in a string list.
TeBox | readBox ()
| Reads a bounding box.
string | readAll ()
| Reads the entire content of the file, skipping new line characters only.
bool | writeCoordPairVect2CSV (const TeCoordPairVect &coordsVec)
bool | readCoordPairVect2CSV (TeCoordPairVect &coordsVec)
double | readAngle (const std::string &value)
| Read Angle.
std::string | readFont ()
| Read a font name.

## Detailed Description

A class for handling reading/writing for ASCII files.

Simple wrapper around a stdio file. Clientes are all the functions that imports from ASCII files.

See also:
  TeStdFile, TeSPRFile

## Constructor & Destructor Documentation

TeAsciiFile::TeAsciiFile | ( | const string & | name,
|  | const char * | mode = `"r"`
| ) |  |

Contructors.

TeAsciiFile::~TeAsciiFile | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

void TeAsciiFile::findNewLine | ( |  | ) |

Goes to a new line.

string TeAsciiFile::readAll | ( |  | ) |

Reads the entire content of the file, skipping new line characters only.

double TeAsciiFile::readAngle | ( | const std::string & | value | ) |

Read Angle.

Method to return the angle of a mid/mif file when it has a text representation

Returns:
  returns the text angle

TeBox TeAsciiFile::readBox | ( |  | ) |

Reads a bounding box.

char TeAsciiFile::readChar | ( |  | ) |

Reads a character.

TeCoord2D TeAsciiFile::readCoord2D | ( |  | ) |

Reads a 2D coordinate ( x, y )

bool TeAsciiFile::readCoordPairVect2CSV | ( | TeCoordPairVect & | coordsVec | ) |

Read a vector os coordinates pairs using the CSV file format (one line per coordinate pair).

Parameters:

  coordsVec | The input coordinate pairs vector.

Returns:
  true if ok, false on errors.

double TeAsciiFile::readFloat | ( |  | ) |

Reads a float.

double TeAsciiFile::readFloatCSV | ( | const char | del = `','` | ) |

Reads a comma-separated float.

std::string TeAsciiFile::readFont | ( |  | ) |

Read a font name.

Methodo to read a font name to text geometry

int TeAsciiFile::readInt | ( |  | ) |

Reads an integer.

int TeAsciiFile::readIntCSV | ( | const char | del = `','` | ) |

Reads a comma-separated int.

string TeAsciiFile::readLine | ( |  | ) |

Reads a full line up to carriage return.

void TeAsciiFile::readNStringCSV | ( | vector< string > & | strlist,
|  | unsigned int | n,
|  | const char | sep = `','`
| ) |  |

Reads the first n strings from a comma separated line string and put in a string list.

char TeAsciiFile::readQuotedChar | ( |  | ) |

Reads a character whithin quotes.

string TeAsciiFile::readQuotedString | ( |  | ) |

Reads a string whithin quotes.

string TeAsciiFile::readString | ( |  | ) |

Reads a string.

string TeAsciiFile::readStringCSV | ( | const char | sep = `','`,
|  | bool | skip = `false`,
|  | const char | skip_char = `' '`
| ) |  |

Reads a comma-separated string ( with a skip character )

string TeAsciiFile::readStringCSVNoQuote | ( | const char | del = `','` | ) |

Reads a comma-separated string (ignore quote )

string TeAsciiFile::readStringCSVNoSpace | ( | const char | del = `','` | ) |

Reads a comma-separated string(ignore spaces)

void TeAsciiFile::readStringList | ( | vector< string > & | strlist | ) |

Reads a line and put in a stringlist.

void TeAsciiFile::readStringListCSV | ( | vector< string > & | strlist,
|  | const char | sep = `','`
| ) |  |

Reads a comma-separated line string and put in a string list.

bool TeAsciiFile::writeCoordPairVect2CSV | ( | const TeCoordPairVect & | coordsVec | ) |

Write a vector os coordinates pairs using the CSV file format (one line per coordinate pair).

Parameters:

  coordsVec | The input coordinate pairs vector.

Returns:
  true if ok, false on errors.

Note:
  15 digits precision

void TeAsciiFile::writeNewLine | ( |  | ) | `[inline]`

Writes a carriage return character.

void TeAsciiFile::writeString | ( | const string & | s | ) |

Writes a generic string to the file.

The documentation for this class was generated from the following files:

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeAsciiFile.h
- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeAsciiFile.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines