Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ns_vu1112112::Parser Class Reference

This defines a parser class. More...

#include <Parser.h>

Collaboration diagram for ns_vu1112112::Parser:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Parser ()
 Default constructor - set initial values.
 ~Parser ()
 Destructor.
bool Parse (const char *filename, vu1112112 &scene)
 Parse the file represented by "filename" and.

Private Member Functions

void CheckError (void)
 Check if an error was encountered during parsing.
bool ReadString (char *s)
 Try to read the static text given by "s" from the buffer.
bool ReadString (char *prefix, char *s)
 Try to read a string prefixed by "prefix" from the buffer.
bool ReadNumber (char *prefix, float &t)
 Try to read a number prefixed by "prefix" from the buffer.
bool ReadVector3 (char *prefix, vuVector &v)
 Try to read a vector prefixed by "prefix" from the buffer.
bool ReadvuVector (char *prefix, vuVector &v)
 Try to read a vector prefixed by "prefix" from the buffer.
bool ReadRGB (char *prefix, vuColourRGBa &r)
 Try to read an vuColourRGBa prefixed by "prefix" from the buffer.
bool ReadvuColourRGBa (char *prefix, vuColourRGBa &r)
 Try to read an vuColourRGBa prefixed by "prefix" from the buffer.
bool ReadSpectrum31 (char *prefix, vuColour31a &s)
bool ReadvuColour31a (char *prefix, vuColour31a &s)
 Try to read a vuColour31a prefixed by "prefix" from the buffer.
bool ReadSpectrum7 (char *prefix, vuColour7a &s)
 Try to read a vuColour7a prefixed by "prefix" from the buffer.
bool ReadvuColour7a (char *prefix, vuColour7a &s)
 Try to read a vuColour7a prefixed by "prefix" from the buffer.
bool ReadSpectrum9 (char *prefix, vuColour9a &s)
 Try to read a vuColour9a prefixed by "prefix" from the buffer.
bool ReadvuColour9a (char *prefix, vuColour9a &s)
 Try to read a vuColour9a prefixed by "prefix" from the buffer.
bool ReadColourType (char *prefix, ColourType &c, ColourUsage u)
 Try to read a colour prefixed by "prefix" from the buffer.
bool ReadMaterial (vu1112112 &r)
 Try to read an Material from the buffer.
bool ReadGeneral (vu1112112 &s)
 Try to read the "general" block from the buffer.
bool ReadTarga (vu1112112 &s)
 Try to read the "image" block from the buffer.
bool ReadLight (vu1112112 &scene)
 Try to read a "light" block from the buffer.
void FixName (char *str)
 crop the string

Private Attributes

vuColour31a m_Ambient
 saves the ambient light of the scene This is used to normalize spectra that are read with this parser.
bool m_ReadAmbient
 a flag
char * m_Buffer
 The character buffer (contains input file text).
int m_Pos
 Current position in the character buffer.

Detailed Description

This defines a parser class.

The parser is used to read scene-files describing objects in a given scene. Hopefully, this class expires when we have a transfer function panel with support for various colour models and load/save facility.

Definition at line 34 of file Parser.h.


Constructor & Destructor Documentation

ns_vu1112112::Parser::Parser  ) 
 

Default constructor - set initial values.

Definition at line 26 of file Parser.cpp.

References m_Buffer, m_Pos, and m_ReadAmbient.

ns_vu1112112::Parser::~Parser  ) 
 

Destructor.

Definition at line 34 of file Parser.cpp.


Member Function Documentation

void ns_vu1112112::Parser::CheckError void   )  [private]
 

Check if an error was encountered during parsing.

Report the position in the file that was successfully parsed up to.

Definition at line 131 of file Parser.cpp.

References m_Buffer, and ReadString().

Referenced by Parse().

Here is the call graph for this function:

void ns_vu1112112::Parser::FixName char *  str  )  [private]
 

crop the string

Definition at line 710 of file Parser.cpp.

Referenced by ReadTarga().

bool ns_vu1112112::Parser::Parse const char *  filename,
vu1112112 scene
 

Parse the file represented by "filename" and.

Returns:
the resulting scene in "scene".

Definition at line 42 of file Parser.cpp.

References CheckError(), m_Buffer, ReadGeneral(), ReadLight(), ReadMaterial(), and ReadTarga().

Referenced by ns_vu1112112::vu1112112::load_scene().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadColourType char *  prefix,
ColourType c,
ColourUsage  u
[private]
 

Try to read a colour prefixed by "prefix" from the buffer.

Do not read the alpha channel.

Definition at line 469 of file Parser.cpp.

References ns_vu1112112::cLight, ColourType, vuColour7a::from(), m_Ambient, m_ReadAmbient, ReadRGB(), ReadSpectrum31(), ReadSpectrum7(), ReadSpectrum9(), ReadvuColour31a(), ReadvuColour7a(), ReadvuColour9a(), and ReadvuColourRGBa().

Referenced by ReadGeneral(), ReadLight(), and ReadMaterial().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadGeneral vu1112112 s  )  [private]
 

Try to read the "general" block from the buffer.

Definition at line 89 of file Parser.cpp.

References ns_vu1112112::vu1112112::Background, ns_vu1112112::vu1112112::brightness, ns_vu1112112::cColour, ColourType, ns_vu1112112::vu1112112::diffuse, ns_vu1112112::vu1112112::light_scale, ns_vu1112112::vu1112112::m_LightDir, vuVector::normalize(), ReadColourType(), ReadNumber(), ReadString(), and ReadVector3().

Referenced by Parse().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadLight vu1112112 scene  )  [private]
 

Try to read a "light" block from the buffer.

Definition at line 683 of file Parser.cpp.

References ns_vu1112112::vu1112112::add_light(), ns_vu1112112::cLight, ColourType, ReadColourType(), and ReadString().

Referenced by Parse().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadMaterial vu1112112 r  )  [private]
 

Try to read an Material from the buffer.

Definition at line 604 of file Parser.cpp.

References ns_vu1112112::Material::absorption, ns_vu1112112::vu1112112::add_material(), ns_vu1112112::cColour, ns_vu1112112::Material::check_absorption(), ColourType, ns_vu1112112::Material::high_th, ns_vu1112112::Material::low_th, ReadColourType(), ReadNumber(), ReadString(), ns_vu1112112::Material::scattering, and ns_vu1112112::Material::xray.

Referenced by Parse().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadNumber char *  prefix,
float t
[private]
 

Try to read a number prefixed by "prefix" from the buffer.

Definition at line 230 of file Parser.cpp.

References m_Buffer, and m_Pos.

Referenced by ReadGeneral(), ReadMaterial(), ReadRGB(), ReadSpectrum31(), ReadSpectrum7(), ReadSpectrum9(), ReadTarga(), ReadVector3(), ReadvuColour31a(), ReadvuColour7a(), ReadvuColour9a(), ReadvuColourRGBa(), and ReadvuVector().

bool ns_vu1112112::Parser::ReadRGB char *  prefix,
vuColourRGBa r
[private]
 

Try to read an vuColourRGBa prefixed by "prefix" from the buffer.

Only read the RGB values.

Definition at line 286 of file Parser.cpp.

References m_Pos, ReadNumber(), and ReadString().

Referenced by ReadColourType().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadSpectrum31 char *  prefix,
vuColour31a s
[private]
 

Definition at line 325 of file Parser.cpp.

References m_Pos, ReadNumber(), and ReadString().

Referenced by ReadColourType().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadSpectrum7 char *  prefix,
vuColour7a s
[private]
 

Try to read a vuColour7a prefixed by "prefix" from the buffer.

Do not read the alpha channel.

Definition at line 373 of file Parser.cpp.

References m_Pos, ReadNumber(), and ReadString().

Referenced by ReadColourType().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadSpectrum9 char *  prefix,
vuColour9a s
[private]
 

Try to read a vuColour9a prefixed by "prefix" from the buffer.

Do not read the alpha channel.

Definition at line 421 of file Parser.cpp.

References m_Pos, ReadNumber(), and ReadString().

Referenced by ReadColourType().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadString char *  prefix,
char *  s
[private]
 

Try to read a string prefixed by "prefix" from the buffer.

Definition at line 209 of file Parser.cpp.

References m_Buffer, m_Pos, and ReadString().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadString char *  s  )  [private]
 

Try to read the static text given by "s" from the buffer.

Definition at line 193 of file Parser.cpp.

References m_Buffer, and m_Pos.

Referenced by CheckError(), ReadGeneral(), ReadLight(), ReadMaterial(), ReadRGB(), ReadSpectrum31(), ReadSpectrum7(), ReadSpectrum9(), ReadString(), ReadTarga(), ReadVector3(), ReadvuColour31a(), ReadvuColour7a(), ReadvuColour9a(), ReadvuColourRGBa(), and ReadvuVector().

bool ns_vu1112112::Parser::ReadTarga vu1112112 s  )  [private]
 

Try to read the "image" block from the buffer.

Definition at line 648 of file Parser.cpp.

References FixName(), vu1::m_Camera, ReadNumber(), ReadString(), vuCamera::setHeight(), and vuCamera::setWidth().

Referenced by Parse().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadVector3 char *  prefix,
vuVector v
[private]
 

Try to read a vector prefixed by "prefix" from the buffer.

The vector read must have 3 members.

Definition at line 247 of file Parser.cpp.

References m_Pos, ReadNumber(), and ReadString().

Referenced by ReadGeneral().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadvuColour31a char *  prefix,
vuColour31a s
[private]
 

Try to read a vuColour31a prefixed by "prefix" from the buffer.

Read all channels.

Definition at line 349 of file Parser.cpp.

References m_Pos, ReadNumber(), and ReadString().

Referenced by ReadColourType().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadvuColour7a char *  prefix,
vuColour7a s
[private]
 

Try to read a vuColour7a prefixed by "prefix" from the buffer.

Read all channels.

Definition at line 397 of file Parser.cpp.

References m_Pos, ReadNumber(), and ReadString().

Referenced by ReadColourType().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadvuColour9a char *  prefix,
vuColour9a s
[private]
 

Try to read a vuColour9a prefixed by "prefix" from the buffer.

Read all channels.

Definition at line 445 of file Parser.cpp.

References m_Pos, ReadNumber(), and ReadString().

Referenced by ReadColourType().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadvuColourRGBa char *  prefix,
vuColourRGBa r
[private]
 

Try to read an vuColourRGBa prefixed by "prefix" from the buffer.

Read all of the vuColourRGBa values.

Definition at line 305 of file Parser.cpp.

References m_Pos, ReadNumber(), and ReadString().

Referenced by ReadColourType().

Here is the call graph for this function:

bool ns_vu1112112::Parser::ReadvuVector char *  prefix,
vuVector v
[private]
 

Try to read a vector prefixed by "prefix" from the buffer.

The vector read must have 4 members.

Definition at line 266 of file Parser.cpp.

References m_Pos, ReadNumber(), and ReadString().

Here is the call graph for this function:


Member Data Documentation

vuColour31a ns_vu1112112::Parser::m_Ambient [private]
 

saves the ambient light of the scene This is used to normalize spectra that are read with this parser.

We would use it if the colour model was RGB which it is not, the case.

Definition at line 127 of file Parser.h.

Referenced by ReadColourType().

char* ns_vu1112112::Parser::m_Buffer [private]
 

The character buffer (contains input file text).

Definition at line 131 of file Parser.h.

Referenced by CheckError(), Parse(), Parser(), ReadNumber(), and ReadString().

int ns_vu1112112::Parser::m_Pos [private]
 

Current position in the character buffer.

Definition at line 132 of file Parser.h.

Referenced by Parser(), ReadNumber(), ReadRGB(), ReadSpectrum31(), ReadSpectrum7(), ReadSpectrum9(), ReadString(), ReadVector3(), ReadvuColour31a(), ReadvuColour7a(), ReadvuColour9a(), ReadvuColourRGBa(), and ReadvuVector().

bool ns_vu1112112::Parser::m_ReadAmbient [private]
 

a flag

Definition at line 128 of file Parser.h.

Referenced by Parser(), and ReadColourType().


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 21:22:12 2004 for vuVolume by  doxygen 1.3.9.1