Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

more::io Namespace Reference

Input, output, file system access, some networking. More...

Compounds

Typedefs

Enumerations

Functions

Variables


Detailed Description

Input, output, file system access, some networking.

Formatted streaming with extended IO manipulators and some basic markup support. Binary streaming (two-way syncronization beween memory and disk). Access to the file system, pipes and sockets.


Typedef Documentation

typedef long double more::io::big_float
 

typedef gen::ntree<std::string> more::io::config_tree
 

The content of a configuration file is here represented as a tree of strings with a special interpretation.

A configuration file usually consists of a sequence of (key, value) assignments. Some configuration files also have sections and subsections. The respresentation is as follows. A branch which has sub-branches is a section named by the node value. If the branch has no sub-branches, it is an assignment. The node value of the branch is the key and the leaves are its values. The tree root is an anonymous section (its node value is an empty string). Empty sections, other than the root, invalidates the tree, and must be removed by the parser or filled with a dummy assignment like '' = ''.

typedef list_of_string::const_iterator more::io::const_list_of_string_iterator
 

typedef basic_ifstream<char, std::char_traits<char> > more::io::ifstream
 

typedef basic_ipstream<char> more::io::ipstream
 

typedef std::list<std::string> more::io::list_of_string
 

typedef list_of_string::iterator more::io::list_of_string_iterator
 

typedef basic_opstream<char> more::io::opstream
 


Enumeration Type Documentation

enum more::io::access_t
 

Enumeration values:
access_none 
access_x 
access_w 
access_wx 
access_r 
access_rx 
access_rw 
access_rwx 

enum more::io::tslang_t
 

Typesetting languages for output streams.

Enumeration values:
tslang_none 
tslang_terminfo 
tslang_latex_text 
tslang_latex_math 
tslang_html 


Function Documentation

std::string absolute_file_name (  std::string    fname,
std::string    dir = "."
) 
 

void add_history (  char *    ln ) 
 

Add a history item to the readline history.

If readline was not detected by configure, this function does nothing.

template<typename Char, typename Traits>
std::basic_ostream<Char, Traits>& beg_sub (  std::basic_ostream< Char, Traits > &    os ) 
 

Begin subscript mode if possible.

template<typename Char, typename Traits>
std::basic_ostream<Char, Traits>& beg_super (  std::basic_ostream< Char, Traits > &    os ) 
 

Begin superscript mode if possible.

void binary_dump (  std::istream &    is,
std::ostream &    os,
bool    print_values_p
) 
 

big_float binary_get_fp (  std::istream &    is ) 
 

void binary_put_fp (  std::ostream &    os,
big_float    x,
int    prec
) 
 

void binary_read (  std::istream &   ,
std::string &   
) 
 

void binary_read (  std::istream &    is,
long double &    x
) 
 

void binary_read (  std::istream &    is,
double &    x
) 
 

void binary_read (  std::istream &    is,
float &    x
) 
 

void binary_read (  std::istream &    is,
bool &    x
)  [inline]
 

void binary_read (  std::istream &    is,
unsigned long &    x
) 
 

void binary_read (  std::istream &    is,
long &    x
) 
 

void binary_read (  std::istream &    is,
unsigned int &    x
) 
 

void binary_read (  std::istream &    is,
int &    x
) 
 

void binary_read (  std::istream &    is,
unsigned short &    x
) 
 

void binary_read (  std::istream &    is,
short &    x
) 
 

void binary_read (  std::istream &    is,
unsigned char &    x
) 
 

void binary_read (  std::istream &    is,
signed char &    x
) 
 

void binary_read (  std::istream &    is,
char &    x
) 
 

void binary_read_raw (  std::istream &   ,
void *   ,
size_t   
) 
 

void binary_read_raw_data (  std::istream &   ,
void *   ,
size_t   
) 
 

size_t binary_read_raw_size (  std::istream &    ) 
 

void binary_write (  std::ostream &   ,
std::string   
) 
 

void binary_write (  std::ostream &    os,
long double const &    x,
int    prec = std::numeric_limits<long double>::digits
) 
 

void binary_write (  std::ostream &    os,
double const &    x,
int    prec = std::numeric_limits<double>::digits
) 
 

void binary_write (  std::ostream &    os,
float const &    x,
int    prec = std::numeric_limits<float>::digits
) 
 

void binary_write (  std::ostream &    os,
bool    x
)  [inline]
 

void binary_write (  std::ostream &    os,
unsigned long    x
) 
 

void binary_write (  std::ostream &    os,
long    x
) 
 

void binary_write (  std::ostream &    os,
unsigned int    x
) 
 

void binary_write (  std::ostream &    os,
int    x
) 
 

void binary_write (  std::ostream &    os,
unsigned short    x
) 
 

void binary_write (  std::ostream &    os,
short    x
) 
 

void binary_write (  std::ostream &    os,
unsigned char    x
) 
 

void binary_write (  std::ostream &    os,
signed char    x
) 
 

void binary_write (  std::ostream &    os,
char    x
) 
 

void binary_write_raw (  std::ostream &   ,
void const *   ,
size_t   
) 
 

template<typename Char, typename Traits>
std::basic_ostream<Char, Traits>& clr_bold (  std::basic_ostream< Char, Traits > &    os ) 
 

Clear bold face style on os if set.

template<typename Char, typename Traits>
std::basic_ostream<Char, Traits>& clr_italic (  std::basic_ostream< Char, Traits > &    os ) 
 

Clear italic style on os if set.

template<typename Char, typename Traits>
std::basic_ostream<Char, Traits>& clr_standout (  std::basic_ostream< Char, Traits > &    os ) 
 

Clear standout style on os if set.

template<typename Char, typename Traits>
std::basic_ostream<Char, Traits>& clr_underline (  std::basic_ostream< Char, Traits > &    os ) 
 

Clear underline style on os if set.

bool copy_node (  std::string const &    srcpath,
std::string const &    dstpath
) 
 

Copy node srcpath to dstpath.

Directories will only be created without copying contents.

bool copy_node_rec (  std::string const &    srcpath,
std::string const &    dstpath
) 
 

Copy node srcpath to dstpath, recursively copying directory contents.

bool create_dir (  std::string    path ) 
 

Create a directory.

Returns true iff successful.

bool create_dir_rec (  std::string    path ) 
 

Create a directory after first creating all nonexisting parents directories.

Returns true iff successful.

bool create_tmp_dir (  std::string &    name ) 
 

Attemts to create a directory with a name starting with name.

If it succeeds, returns true and there will be a newly created directory with permissions 0700 (Unix). Otherwise returns false. The directory and its contents will be removed at exit.

std::string current_directory (    ) 
 

std::string directory_as_file_name (  std::string    fname ) 
 

template<typename Char, typename Traits>
std::basic_ostream<Char, Traits>& end_sub (  std::basic_ostream< Char, Traits > &    os ) 
 

End subscript mode.

template<typename Char, typename Traits>
std::basic_ostream<Char, Traits>& end_super (  std::basic_ostream< Char, Traits > &    os ) 
 

End superscript mode.

std::string file_name_as_directory (  std::string    fname ) 
 

std::string file_name_directory (  std::string    fname ) 
 

std::string file_name_extension (  std::string    fname ) 
 

std::string file_name_nondirectory (  std::string    fname ) 
 

std::string file_name_sans_extension (  std::string    fname ) 
 

bool grep_string (  std::string const &    path,
std::string const &    str
) 
 

Returns true iff the file at path contains str.

This version searches line by line, so str should not contain any newlines.

bool has_bold (  std::ios_base &    ) 
 

bool has_italic (  std::ios_base &    ) 
 

bool has_rec_scripts (  std::ios_base    ) 
 

bool has_scripts (  std::ios_base &    ) 
 

bool has_stadout (  std::ios_base &    ) 
 

bool has_underline (  std::ios_base &    ) 
 

std::string home_dir (    ) 
 

std::string home_file (  std::string    fname ) 
 

bool is_config_assignment (  config_tree const &    t )  [inline]
 

True iff the t configuration subtree is an assignment (branch with only leaves).

bool is_config_section (  config_tree const &    t )  [inline]
 

True iff the t configuration subtree is a section.

bool is_config_value (  config_tree const &    t )  [inline]
 

True iff the t configuration subtree is a value (leaf).

bool is_file_name_absolute (  std::string    fname ) 
 

bool is_file_name_directory (  std::string    fname ) 
 

bool is_file_name_non_directory (  std::string    fname ) 
 

bool is_valid_config_tree (  config_tree const &    t ) 
 

True if t is a valid configuration tree.

Config file parsers should return valid configuration trees, so this is mostly useful for debugging parsers.

template<typename Char>
buffer<Char>::driver* new_ifdriver (  char const *    name,
bool    want_eof
) 
 

Allocates a driver for input from the file with named name, or stdin if name=0.

template<typename Char, typename Traits>
buffer<Char>::driver* new_isdriver (  std::basic_string< Char, Traits > const &    str,
bool    want_eof
) 
 

template<typename Char>
buffer<Char>::driver* new_ofdriver (  char const *    name ) 
 

Allocates a driver for output to file named name.

template<typename Char, typename Traits>
buffer<Char>::driver* new_osdriver (  std::basic_string< Char, Traits > &    str ) 
 

template<typename Char>
buffer<Char>::driver* new_readline_driver (  char *    prompt,
bool    want_eof,
Char *    sep
)  [inline]
 

Return readline driver for a buffer.

A sep is inserted in front of each line, including the first. Reading over these characters causes a prompt. sep is typically a newline, and serve as dummy lookahead character(s) which allows the prompt to be delayed until the program skips over white-spaces for the purpose of reading something. The driver will be free by the buffer.

template<typename Char>
buffer<Char>::driver* new_readline_driver (  char *    prompt,
bool    want_eof = false
)  [inline]
 

Return a readline driver for a buffer.

This is the same as the other overload with sep = "
"
or sep = L"
"
as appropriate.

access_t operator & (  access_t    x,
access_t    y
)  [inline]
 

access_t& operator &= (  access_t &    x,
access_t    y
)  [inline]
 

template<typename Char, typename Traits>
std::basic_ostream<Char, Traits>& operator<< (  std::basic_ostream< Char, Traits > &    os,
sourceref const &    loc
) 
 

std::ostream& operator<< (  std::ostream &   ,
internet_address const &   
) 
 

std::istream& operator>> (  std::istream &   ,
internet_address &   
) 
 

access_t operator| (  access_t    x,
access_t    y
)  [inline]
 

access_t& operator|= (  access_t &    x,
access_t    y
)  [inline]
 

access_t operator~ (  access_t    acc )  [inline]
 

std::string path_list_to_file_name (  const_list_of_string_iterator    first,
const_list_of_string_iterator    past_end,
std::string    dir = "."
) 
 

void read_config_kevn (  config_tree &    t_out,
std::string const &    file_name
) 
 

Read config file in key-equal-value-newline format.

The top-level branches are appended to t_out.

void read_config_ksvn (  config_tree &    t_out,
std::string const &    file_name
) 
 

Read config file in key-space-value-newline format.

The top-level branches are appended to t_out.

char* readline (  char *    prompt ) 
 

Prompt the user for input.

Readline is used if it was detected by configure, otherwise the std::cout and std::cin are used.

std::string relative_file_name (  std::string    fpath,
std::string    dir
) 
 

bool remove_node (  std::string const &    path ) 
 

Remove a file or a directory.

Returns true iff successful.

void remove_node_at_exit (  std::string const &    path ) 
 

Calls remove(path) at exit.

bool remove_node_rec (  std::string const &    path ) 
 

Remove all files in a directory and the directory itself, USE WITH CARE! Returns true iff successful.

void remove_node_rec_at_exit (  std::string const &    path ) 
 

Calls remove_recursive(path) at exit, USE WITH CARE!

bool rename_node (  std::string const &    oldpath,
std::string const &    newpath
) 
 

Rename a file or a directory.

Returns true iff successful.

std::string replace_extension (  std::string    fname,
std::string    ext
) 
 

bool reserve_tmp_file (  std::string &    name,
bool    remove_p = true
) 
 

Attempts to reserve a unique file name starting with name.

If it succeeds, an empty file with permissions 0600 (Unix) will be created, name is modified to the name of this file and true is returned. Otherwise false is returned. The file will be removed at exit if remove_p=true. If remove_p == true, do not remove the file yourself, as some other application may then reuse the file name and loose its file the file when your program exits!

std::string resolve_file_name (  std::string    fname,
std::string    dir = "."
) 
 

template<typename Char, typename Traits>
std::basic_ostream<Char, Traits>& set_bold (  std::basic_ostream< Char, Traits > &    os ) 
 

If possible set bold face style on os.

template<typename Char, typename Traits>
std::basic_ostream<Char, Traits>& set_italic (  std::basic_ostream< Char, Traits > &    os ) 
 

If possible set italic style on os.

template<typename Char, typename Traits>
std::basic_ostream<Char, Traits>& set_standout (  std::basic_ostream< Char, Traits > &    os ) 
 

If possible set standout style on os.

void set_tslang (  std::ios_base &   ,
tslang_t   
) 
 

template<typename Char, typename Traits>
std::basic_ostream<Char, Traits>& set_underline (  std::basic_ostream< Char, Traits > &    os ) 
 

If possible set underline style on os.

std::pair<std::string, std::string> split_file_name (  std::string    fname ) 
 

template<typename Assoc>
void sync_associative_container (  syncstream &    sio,
Assoc &    x
) 
 

Sync an associative container (like a std::set).

template<typename Assoc>
void sync_pair_associative_container (  syncstream &    sio,
Assoc &    x
) 
 

Sync a pair-associative container (like a std::map).

template<typename Iterator>
void sync_range (  syncstream &    sio,
Iterator    first,
Iterator    last
) 
 

Sync an length iterator range of known length.

template<typename Seq>
void sync_sequence (  syncstream &    sio,
Seq &    c
) 
 

Sync a sequence (like a std::list or a std::vector).

template<typename T>
void sync_skip (  syncstream &    sio,
int    i = 1
) 
 

Skip i items of type T.

tslang_t tslang (  std::ios_base &    ) 
 


Variable Documentation

struct more::io::infinite_tag more::io::infinite
 


Generated on Sat Sep 7 19:12:39 2002 for more with Doxygen 1.2.13.1. Doxygen 1.2.13.1 is written and copyright 1997-2002 by Dimitri van Heesch.