KrisLibrary  1.0.0
Functions
ioutils.h File Reference

Utilities for I/O. More...

#include <iostream>
#include <string>
#include <vector>
#include <KrisLibrary/File.h>

Go to the source code of this file.

Functions

void EatWhitespace (std::istream &in)
 Eats up whitespace at beginning of stream.
 
bool InputToken (std::istream &in, const char *characterSet, std::string &)
 
bool InputQuotedString (std::istream &in, char *str, int n)
 Gets a quoted string from the istream into a char buffer (or string)
 
bool InputQuotedString (std::istream &in, std::string &)
 
void OutputQuotedString (std::ostream &out, const char *str)
 Outputs "str". Outputs " for quote characters in str.
 
void OutputQuotedString (std::ostream &out, const std::string &)
 
bool StringContainsQuote (char *str)
 Returns true if str has a quote character.
 
bool StringContainsQuote (const std::string &str)
 
bool StringRequiresQuoting (char *str)
 Returns true if outputting string requires quotations.
 
bool StringRequiresQuoting (const std::string &str)
 
bool SafeInputString (std::istream &in, char *str, int n)
 Inputs the string with quotes if necessary.
 
bool SafeInputString (std::istream &in, std::string &)
 
void SafeOutputString (std::ostream &out, const char *str)
 Outputs the string with quotes if necessary.
 
void SafeOutputString (std::ostream &out, const std::string &)
 
bool SafeInputFloat (std::istream &in, float &f)
 I/O with denormalized floats (infinity, NaN)
 
bool SafeInputFloat (std::istream &in, double &f)
 
bool SafeOutputFloat (std::ostream &out, float f)
 
bool SafeOutputFloat (std::ostream &out, double f)
 
int TranslateEscape (int c)
 
std::string TranslateEscapes (const std::string &str)
 
bool GetFileContents (const char *filename, std::string &contents)
 Returns the entire contents of a file as a string.
 
template<class type >
bool ReadFile (File &f, std::vector< type > &v)
 ReadFile() for STL vectors. See File.h.
 
template<class type >
bool WriteFile (File &f, const std::vector< type > &v)
 WriteFile() for STL vectors. See File.h.
 
template<class type >
bool InputVector (std::istream &in, std::vector< type > &v)
 
template<class type >
bool OutputVector (std::ostream &out, const std::vector< type > &v)
 

Detailed Description

Utilities for I/O.