as2js: as2js::StandardInput Class Reference

#include <stream.h>

Inheritance diagram for as2js::StandardInput:
Collaboration diagram for as2js::StandardInput:
Public Types typedef as_char_t char_t   typedef std::shared_ptr< StandardInputpointer_t   Public Member Functions  StandardInput ()  Use standard input as the input stream. More...
  Positionget_position ()  Get the position object of the input object. More...
  Position const & get_position () const  Get the position object of the input object. More...
  char_t getc ()  Get one character. More...
  void ungetc (char_t c)  Unget one character. More...
  Static Public Attributes static char_t const INPUT_EOF = -1   static char_t const INPUT_ERR = -3   static char_t const INPUT_NAC = -2   Protected Member Functions virtual char_t filter_getc ()  Get the next character. More...
  virtual char_t get_byte ()  Read one by from the standard input. More...
  Detailed Description

Definition at line 182 of file stream.h.

Member Typedef Documentation
typedef as_char_t as2js::Input::char_t inherited

Definition at line 153 of file stream.h.

Definition at line 186 of file stream.h.

Constructor & Destructor Documentation
as2js::StandardInput::StandardInput ( )

This function sets up the input file to the standard input of the process. In that case the filename is set to "-". However, there is not size available.

The function first calls close() to make sure that any previous call to standard_input() or open() get cleaned up.

true if the file could be opened.

Definition at line 677 of file stream.cpp.

References as2js::Input::get_position(), and as2js::Position::set_filename().

Member Function Documentation
Input::char_t as2js::Input::filter_getc ( ) protectedvirtualinherited

This function reads the next character from the input. In most cases this reads one or more bytes from the input file, and then it converts those bytes in a character using a filter.

This function does not return Input::INPUT_NAC. Instead it reads as much data as it can and returns the next character, no matter what. However, it may return EOF if the end of the file is reached, or ERR if a character in the stream is not valid. There are two types of invalid characters: (1) numbers that are outside of the Unicode range (0 .. 0x010FFFF) or a UTF-16 surrogate in a format that does not support such surrogate (UTF-8, UTF-32), and (2) byte sequences that end before a valid character can be formed (missing surrogate, invalid UTF-8).

The next character, Input::INPUT_EOF, or Input::INPUT_ERR.

Reimplemented in as2js::StringInput.

Definition at line 609 of file stream.cpp.

References as2js::Input::f_filter, as2js::Input::get_byte(), as2js::Input::INPUT_EOF, as2js::Input::INPUT_ERR, and as2js::Input::INPUT_NAC.

Referenced by as2js::Input::getc().

Input::char_t as2js::StandardInput::get_byte ( ) protectedvirtual

This function returns the next byte found in the standard input stream.

If the input stream can end and the end was reached, then INPUT_EOF is returned.

The next byte from the input stream.

Reimplemented from as2js::Input.

Definition at line 693 of file stream.cpp.

References as2js::Input::INPUT_EOF.

Position & as2js::Input::get_position ( ) inherited

The stream manages a position object. The call can use this function to retrieve a read/write version of the current position.

A modifiable version of the position object.

Definition at line 532 of file stream.cpp.

References as2js::Input::f_position.

Referenced by as2js::StandardOutput::internal_write(), as2js::FileOutput::internal_write(), as2js::FileInput::open(), as2js::FileOutput::open(), StandardInput(), as2js::StandardOutput::StandardOutput(), and as2js::StringInput::StringInput().

Position const & as2js::Input::get_position ( ) const inherited

The stream manages a position object. The call can use this function to retrieve a read-only version of the current position.

A constant version of the position object.

Definition at line 545 of file stream.cpp.

References as2js::Input::f_position.

Input::char_t as2js::Input::getc ( ) inherited

This function retrieves the next character from the input object.

If the caller used the ungetc() function, then the characters that were ungotten are returned first in the opposite order (FILO).

The next character available in the stream.

Definition at line 560 of file stream.cpp.

References as2js::Input::f_unget, and as2js::Input::filter_getc().

void as2js::Input::ungetc ( char_t  c) inherited

This function saves the specified character c in a buffer of the Input object. The next getc() call will first return that last character the caller unget.

[in]cThe character to unget.

Definition at line 580 of file stream.cpp.

References as2js::Input::f_unget.

Member Data Documentation
The documentation for this class was generated from the following files:
  • /home/snapwebsites/snapcpp/contrib/as2js/include/as2js/stream.h
  • /home/snapwebsites/snapcpp/contrib/as2js/lib/stream.cpp

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly