Overview

---------------------------------------------------------------
| -- START OF FILE -- -- START OF FILE -- -- START OF FILE -- |
---------------------------------------------------------------
---------------------------------------------------------------
StreamCheck 
FileList:
-ZLOG.h
-ZLOG.cpp
Verison 0.1.1.1
Built in C++ 
Created by unsignedzero

64CR(64 character per line plus carriage return)

For the sake of disambiguation, function names in the README
start with a capital letter. However, in the actual code, all
function names are typically lowercase. To see the correct 
casing, see the section of the actual function in question.

Please READ THIS TEXT FILE BEFORE ASKING QUESTIONS! If this 
file is incomplete, please go to, 
https://bitbucket.org/unsignedzero/log_zero and download 
the file again, or read it there. 

Abstract:

This code, along was ZINI, was once part of a larger code for
manipulating text. The purpose of this code is to buffer 
output text so that it can be rewritten to a text file, or 
even std::cout at a later time, when it is more convenient. 
While this program does seem trivial, when used correctly it
can speed up writes quite a bit. Rather than calling 
std::cout twenty times, it calls it only when needed, speeding 
up the visual functional of the program. (This is primarily 
true with windows. ) The functions are located in ZX namespace.
---------------------------------------------------------------
---------------------------------------------------------------

 - Table of Contents
 - - Use Ctrl/Cmd + F to jump to certain part of this text
 - - using the characters between the [ and ].

 -  (0*) Information
 - - 00 [Adin] Additional Information
 - - 01 [DEBG] Debug Information
 - - 02 [ZLNK] ZX File Linking

 -  (A*) Functions 
 - - A0 [0FS0] File( String )
 - - A1 [0FSI] File( String , Integer )
 - - A2 [WRIT] Write
 - - A3 [0OP0] Operator<< 
 - - A4 [RED1] Read( Template )
 - - A5 [RED2] Read( Template, Integer )
 - - A6 [RED3] Read( Template, Template )
 
 -  (O*) Observer Functions
 - - O1 [FILE] FileName
 - - O2 [0CH0] Check
 - - O3 [OST0] Status
 - - O4 [SIZE] Size
 - - O5 [LENG] Length
 - - O6 [CLAR] Clear

 -  (C*) Class ConStructors
 - - C1 [CC01] ZLOG( void )
 - - C2 [CC02] ZLOG( String )
 - - C3 [CC03] ZLOG( String , Integer )
 - - C4 [CC04] ZLOG( Integer )

 -  (D*) Class DeConStructors
 - - D1 [CD01]~ZLOG ( void )

 -  (P*) Private Functions 
 - - NONE

 -  (Z*) End Information
 - - Z0 [ABUT] About 

---------------------------------------------------------------
---------------------------------------------------------------
 -  (0*) Information
---------------------------------------------------------------
 - - 00 [Adin] Additional Information

The additional constructors provide a faster way, one call, to
create the class and initialize it. The string passed is for 
the filename while the integer select the mode. 

The mode is mainly needed for Windows, as unix/linux systems 
always reads files in binary mode. In Windows system, reading
files via binary mode, it how one would normally perceive text
reading to be. However in normal mode, certain expression may 
be expanded, compiler dependant, and so results CAN vary due 
to the methodology used and libraries in question. As such, 
switching to binary, can result in consistent text reading. 

Functions have varying names and arguments but one can 
usually guess what the function will do and arguments needed. 

Remember that the functions are placed in zx namespace so add
"zx::" in front of the function name, when calling it, OR add
"using namespace zx;" AFTER including the file with 
#include "SC.h"

---------------------------------------------------------------
 - - 01 [DEBG] Debug Information

This code has debug information that can be turned on/off when 
compiling. The defines MUST BE ENTERED before including ZLOG.H!
Entering it in AFTER MAY HAVE unexpected results, depending on 
the compiler. Remember that defines are case-sensitive!

Additional warning messages can be turned on 
can be turned on by setting ZX_SC_DEBUG to true with a 
"#define ZX_ZOS_DEBUG true".
[BY default this is set to false!]

This sets the default name of the file, should be stream be 
forced to write. 
Must be set to a value (file name) USE
quotes.
"#define ZLOG_DEFAULT_FNAME "filename" "
[By default this is set to default.txt]

This set the default write settings on the code. TRUE means it
will write to the default file , if it cannot write ANYWHERE
else. 
"#define ZLOG_NO_FILE_WRITE true"
[By default this is true!]

This sets up a dual buffer, one for file write and one for
std::cout. Certain functions CHANGE when this is set on.
"#define ZLOG_DUAL_BUFFER true"
[By default this is set to false!]

---------------------------------------------------------------
 - - 02 [ZLNK] ZX File Linking

This code can be linked with other files created by 
unsignedzero to get additional functional from those 
files. ERRORS may result IF these files ARE INCLUDED after 
this code! For more information on file linking go to ...

Currently this program can be linked to:

 - ZOS 
 - - To pause correctly regardless on the OS this code is 
 - - compiled on 

---------------------------------------------------------------
 -  (A*) Functions 
---------------------------------------------------------------
 - - A0 [0FS0] File( String )

Function:
void zx::file
( std::string in );

This sets the file stream of ZLOG.

-PreCondition:
A string of the filename is passed.

-PostCondition:
A output file log of that name is created.

---------------------------------------------------------------
 - - A1 [0FSI] File( String , Integer )

Function:
void zx::file
( std::string in , int inn);

This sets the file stream of ZLOG. Unlike the first one, this
gives the ability to set the "mode" of ifstream. 

-PreCondition:
A string of the filename and the mode is passed.

-PostCondition:
A output file log of that name is created.

!WARNING:Sending values that are not 0 and 1 WILL HAVE
 UNEXPECTED RESULTS!

---------------------------------------------------------------
 - - A2 [WRIT] Write

Function:
template <class type>
void zx::write
();

This sets tells the function to write to the file. 
*If ZLOG_DUAL_BUFFER is true, the second buffer will
write to std::cout.

-PreCondition:
None

-PostCondition:
The buffer is emptied into the text file.
*The dbuffer will write to std::cout.


---------------------------------------------------------------
 - - A3 [0OP0] Operator<< 

Function:
void zx::ZLOG
operator<<

This is the stream version of read.
This template function gives the programmer the ability to 
send any native type or any class ( so long as the << operator
is defined for the class. )

-PreCondition:
Data is passed.

-PostCondition:
The data is written to the buffer

!WARNING:Sending classes without the operator << defined WILL
 create problems!

---------------------------------------------------------------
 - - A4 [RED1] Read( Template )

Function:
template <class type>
void read
(type let);

This template function gives the programmer the ability to 
send any native type or any class ( so long as the << operator
is defined for that class. ) *If ZLOG_DUAL_BUFFER is true,
both buffers ARE written the same data.

-PreCondition:
Data is passed.

-PostCondition:
The data is written to the buffer.
*The same data will also be written to dbuffer.

!WARNING:Sending classes without the operator << defined WILL
 create problems!

---------------------------------------------------------------
 - - A5 [RED2] Read( Template, Integer )

Function:
template <class type>
void read
(type let, int mode);

*This function is ONLY defined when ZLOG_DUAL_BUFFER is true!

This template function gives the programmer the ability to 
send any native type or any class ( so long as the << 
operator is defined for that class. ) to the selected 
stream.


-PreCondition:
Data is passed and mode is selected.

-PostCondition:
The data is written to the selected buffer.

!WARNING:Sending classes without the operator << defined WILL
 create problems!

---------------------------------------------------------------
 - - A6 [RED3] Read( Template, Template )

Function:
template <class type, class dtype>
void read
(type let, dtype dlet)

*This function is ONLY defined when ZLOG_DUAL_BUFFER is true!

This template function gives the programmer the ability to 
send two different native type and/or classes ( so long as 
the << operator is defined for that class. ) To each stream
independantly.

-PreCondition:
Two data pieces are passed.

-PostCondition:
Each data piece is writen to the respective stream.

!WARNING:Sending classes without the operator << defined WILL
 create problems!

---------------------------------------------------------------
 -  (O*) Observer Functions
---------------------------------------------------------------
 - - O1 [FILE] FileName

Function:
std::string zx::ZLOG::filename
();

This function returns the filename in use. 

-PreCondition:
None

-PostCondition:
A string containing the file name is return.

---------------------------------------------------------------
 - - O2 [0CH0] Check

Function:
bool zx::ZLOG::check
();

This function returns the status of ZLOG.

-PreCondition:
None

-PostCondition:
A bool status is returned.

---------------------------------------------------------------
 - - O3 [OST0] Status

Function:
bool zx::ZLOG::status
();

This is the same as Check, with a different name.

-PreCondition:
None

-PostCondition:
A bool status is returned.

---------------------------------------------------------------
 - - O4 [SIZE] Size

Function:
int zx::ZLOG::size
();

This function returns the size of buffer and has an alias 
called Length.

*If ZLOG_DUAL_BUFFER is true, this function will return the sum of
BOTH buffers sizes.

-PreCondition:
None

-PostCondition:
A interger size is returned.

---------------------------------------------------------------
 - - O5 [LENG] Length

Function:
int zx::ZLOG::length
();

This is the same as Size, with a different name.

-PreCondition:
None

-PostCondition:
A interger size is returned.

---------------------------------------------------------------
 - - O6 [CLAR] Clear

Function:
void zx::ZLOG::clear
();

This MANUALLY EMPTIES THE BUFFER.

*If ZLOG_DUAL_BUFFER is true, this function will EMPTY BOTH 
BUFFERS.

-PreCondition:
None

-PostCondition:
The buffer is emptied. 
*The dbuffer is emptied.

---------------------------------------------------------------
 -  (C*) Class ConStructors
---------------------------------------------------------------
 - - C1 [CC01] ZLOG( void )

Function:
void zx::ZLOG::ZLOG
();

This is the basic NULL constuctor.

-PreCondition:
None

-PostCondition:
The ZLOG class is initialized to a proper state.

---------------------------------------------------------------
 - - C2 [CC02] ZLOG( String )

Function:
void zx::ZLOG::ZLOG
( std::string in );

-PreCondition:
A string filename is passed.

-PostCondition:
This consturctor initializes ZLOG to the correct file.

---------------------------------------------------------------
 - - C3 [CC03] ZLOG( String , Integer )

Function:
void zx::ZLOG::ZLOG
( std::string, integer in2 );

-PreCondition:
A file name and integer type is passed.

-PostCondition:
This consturctor initializes ZLOG to the correct file, with 
options.

---------------------------------------------------------------
 - - C4 [CC04] ZLOG( Integer )

Function:
void zx::ZLOG::ZLOG
( integer in2 );

-PreCondition:
A number is passed.

--PostCondition:
This constructor offers the following:

If 0 is passed: default constructor.
If 1 is passed: CLI prompt is given.


---------------------------------------------------------------
 -  (D*) Class DeConStructors
---------------------------------------------------------------
 - - D1 [CD01]~ZLOG ( void )

Function:
void zx::ZLOG::~ZLOG
();

-PreCondition
Nothing

-PostCondition
Whatever is left in the buffer is written.
Then the pointers are deleted.

---------------------------------------------------------------
 -  (Z*) End Information
---------------------------------------------------------------
 - - Z0 [ABUT] About 

This program was originally part of a larger code whose 
purpose is to read text from files, selectively format the text
and then output it to a file. (Note: Initial releases
do not contain anything special.)

Original Project Name:Log Zero
Started November 04, 2010
Created by unsignedzero
Built in C++ on Code::Blocks V8.02 Unicode

For more information see 
https://bitbucket.org/unsignedzero/log_zero
You may contact me via email (unsignedzero@gmail.com) if you
have any suggestions and comments. I DON'T check it daily. 

---------------------------------------------------------------
---------------------------------------------------------------
|  -- END OF FILE --   -- END OF FILE --   -- END OF FILE --  |
---------------------------------------------------------------