Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  
Public Member Functions | Private Member Functions | Private Attributes

SgGameWriter Class Reference

Write file with SGF data. More...

#include <SgGameWriter.h>

List of all members.

Public Member Functions

 SgGameWriter (std::ostream &out)
void WriteGame (const SgNode &root, bool allProps, int fileFormat, int gameNumber, int defaultSize)
 Write the game tree at 'root' to the given archive.

Private Member Functions

void ConvertFormat (SgNode &root)
void HandleProps (const SgNode *node, int &boardSize) const
bool ShouldWriteProperty (const SgProp &prop)
 Should property be written to file? May depend on options.
void StartNewLine ()
void WriteNode (const SgNode &node, bool allProps, int boardSize, SgPropPointFmt fmt)
void WriteSubtree (const SgNode &node, bool allProps, int boardSize, SgPropPointFmt fmt)
 SgGameWriter (const SgGameWriter &)
 Not implemented.
SgGameWriteroperator= (const SgGameWriter &)
 Not implemented.

Private Attributes

std::ostream & m_out
int m_fileFormat
int m_numPropsOnLine
 Number of properties on this line.

Detailed Description

Write file with SGF data.

Definition at line 16 of file SgGameWriter.h.


Constructor & Destructor Documentation

SgGameWriter::SgGameWriter ( std::ostream &  out  ) 

Definition at line 18 of file SgGameWriter.cpp.

SgGameWriter::SgGameWriter ( const SgGameWriter  )  [private]

Not implemented.


Member Function Documentation

void SgGameWriter::ConvertFormat ( SgNode root  )  [private]
void SgGameWriter::HandleProps ( const SgNode node,
int &  boardSize 
) const [private]

Definition at line 73 of file SgGameWriter.cpp.

References SgNode::GetIntProp(), SG_MAX_SIZE, SG_MIN_SIZE, SG_PROP_SIZE, and SgWarning().

Referenced by WriteSubtree().

SgGameWriter& SgGameWriter::operator= ( const SgGameWriter  )  [private]

Not implemented.

bool SgGameWriter::ShouldWriteProperty ( const SgProp prop  )  [private]

Should property be written to file? May depend on options.

Definition at line 125 of file SgGameWriter.cpp.

References SgProp::Flag(), SgProp::ID(), SgProp::Label(), m_fileFormat, SG_PROP_TIME_BLACK, SG_PROP_TIME_WHITE, and SG_PROPCLASS_NOTCLEAN.

Referenced by WriteNode().

void SgGameWriter::StartNewLine (  )  [private]

Definition at line 115 of file SgGameWriter.cpp.

References m_numPropsOnLine, and m_out.

Referenced by WriteNode(), and WriteSubtree().

void SgGameWriter::WriteGame ( const SgNode root,
bool  allProps,
int  fileFormat,
int  gameNumber,
int  defaultSize 
)

Write the game tree at 'root' to the given archive.

Parameters:
root Root node of the game.
allProps Write all properties.
fileFormat if zero, write it out with the default file format.
gameNumber Game number (will add GM property)
defaultSize The (game-dependent) default board size, if file contains no SZ property.
Exceptions:
SgException If saving fails (presently it does only check if the file is ok at the beginning, not if all writes succeed)

Definition at line 25 of file SgGameWriter.cpp.

References SgNode::GetIntProp(), SgPropUtil::GetPointFmt(), SgNode::HasProp(), m_fileFormat, m_out, SG_PROP_FORMAT, and WriteSubtree().

void SgGameWriter::WriteNode ( const SgNode node,
bool  allProps,
int  boardSize,
SgPropPointFmt  fmt 
) [private]
void SgGameWriter::WriteSubtree ( const SgNode node,
bool  allProps,
int  boardSize,
SgPropPointFmt  fmt 
) [private]

Member Data Documentation

Definition at line 36 of file SgGameWriter.h.

Referenced by ShouldWriteProperty(), WriteGame(), and WriteNode().

Number of properties on this line.

Definition at line 39 of file SgGameWriter.h.

Referenced by StartNewLine(), and WriteNode().

std::ostream& SgGameWriter::m_out [private]

Definition at line 34 of file SgGameWriter.h.

Referenced by StartNewLine(), WriteGame(), WriteNode(), and WriteSubtree().


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


Sun Mar 13 2011 Doxygen 1.7.1