Пример #1
0
bool IniFormatter::writeToStream(const Node* root, Stream* stream, unsigned int tcount, unsigned int nameformat, unsigned int varformat) {
	if (root && stream) {
		UnicodeString temp;
		if (root->getParent() && root->getName().length()>0) { // cheap way of saying the node is not a root node
			writeTabs(stream, tcount, false);
			root->getNameFormatted(temp, nameformat);
			stream->writeChar16('[');
			temp.append(']');
			stream->writeLine(temp);
		}
		Node* node;
		ValueVariable* value;
		for (VarList::const_iterator iter=root->begin(); iter!=root->end(); ++iter) {
			value=dynamic_cast<ValueVariable*>(*iter);
			node=dynamic_cast<Node*>(*iter);
			if (node) {
				writeToStream(node, stream, tcount, nameformat, varformat);
			} else if (value) {
				if (formatValue(*value, temp, nameformat, varformat)) {
					writeTabs(stream, tcount, false);
					stream->writeLine(temp);
				}
			}
		}
		return true;
	}
	return false;
}
Пример #2
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::WorldBegin()
{
	writeTabs();
	m_ribFile<<"WorldBegin "<<std::endl;
	++m_tabs;
	++m_worldCount;
}
Пример #3
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::TransformEnd()
{
	--m_tabs;
	writeTabs();
	m_ribFile<<"TransformEnd "<<std::endl;
	--m_transformCount;
}
Пример #4
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::TransformBegin()
{
	writeTabs();
	m_ribFile<<"TransformBegin "<<std::endl;
	++m_tabs;
	++m_transformCount;
}
Пример #5
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::WorldEnd()
{
	--m_tabs;
	writeTabs();
	m_ribFile<<"WorldEnd "<<std::endl;
	--m_worldCount;
}
Пример #6
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::AttributeBegin()
{
	writeTabs();
	m_ribFile<<"AttributeBegin "<<std::endl;
	++m_tabs;
	++m_attribCount;
}
Пример #7
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::AttributeEnd()
{
	--m_tabs;
	writeTabs();
	m_ribFile<<"AttributeEnd "<<std::endl;
	m_attribCount--;
}
Пример #8
0
 size_t write(uint8_t c) {
   size_t n = 0;
   if (isNewLine) n += writeTabs();
   n += sink->write(c);
   isNewLine = c == '\n';
   return n;
 }
Пример #9
0
	void writeStream(std::ostream &stream, int tabCount)
	{
		for(ValueMap::iterator vi = values.begin(); vi != values.end(); ++vi)
		{
			writeTabs(stream, tabCount);
			stream << (*vi).first << " = " << (*vi).second << std::endl;
		}

		for(GroupMap::iterator gi = groups.begin(); gi != groups.end(); ++gi)
		{
			if((gi != groups.begin()) || (!values.empty()))
				stream << std::endl;

			writeTabs(stream, tabCount);
			stream << (*gi).first << std::endl;

			writeTabs(stream, tabCount);
			stream << "{" << std::endl;

			(*gi).second->writeStream(stream, tabCount + 1),
			
			writeTabs(stream, tabCount);
			stream << "}" << std::endl;			
		}

		if(!lines.empty() && ((!groups.empty() || !values.empty())))
			stream << std::endl;

		for(LineList::iterator li = lines.begin(); li != lines.end(); ++li)
		{
			writeTabs(stream, tabCount);

			std::string &f = (*li);
			stream << (*li) << std::endl;
		}
	}
Пример #10
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::Scale(const Real _x, const Real _y, const Real _z )
{
	writeTabs();
	m_ribFile<<"Scale "<<_x<<" "<<_y<<" "<<_z<<std::endl;
}
Пример #11
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::Torus( const Real _major, const Real _minor, const Real _phiMin,const Real _phiMax, const Real _sweep  )
{
	writeTabs();
	m_ribFile<<"Torus "<<_major<<" "<<_minor<<" "<<_phiMin<<" "<<_phiMax<<" "<<_sweep<<std::endl;
}
Пример #12
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::Disk( const Real _height,const Real _radius, const Real _sweep )
{
	writeTabs();
	m_ribFile<<"Disk "<<_height<<" "<<_radius<<" "<<_sweep<<std::endl;
}
Пример #13
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::Hyperboloid( const Real _p1, const Real _p2, const Real _sweep )
{
	writeTabs();
	m_ribFile<<"Hyperboloid "<<_p1<<" "<<_p2<<" "<<_sweep<<std::endl;
}
Пример #14
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::Paraboloid(const Real _topRad,const Real _zMin, const Real _zMax,  const Real _sweep   )
{
	writeTabs();
	m_ribFile<<"Paraboloid "<<_topRad<<" "<<_zMin<<" "<<_zMax<<" "<<_sweep<<std::endl;
}
Пример #15
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::Cylinder( const Real _radius, const Real _zMin,  const Real _zMax, const Real _sweep  )
{
	writeTabs();
	m_ribFile<<"Cylinder "<<_radius<<" "<<_zMin<<" "<<_zMax<<" "<<_sweep<<std::endl;
}
Пример #16
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::Sphere(const Real _radius, const Real _zMin,const Real _zMax, const Real _sweep )
{
	writeTabs();
	m_ribFile<<"Sphere "<<_radius<<" "<<_zMin<<" "<<_zMax<<" "<<_sweep<<std::endl;
}
Пример #17
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::Rotate(const Real _angle,const Real _x, const Real _y, const Real _z )
{
	writeTabs();
	m_ribFile<<"Rotate "<<_angle<<" "<<_x<<" "<<_y<<" "<<_z<<std::endl;
}
Пример #18
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::Translate( const Real _x,   const Real _y,  const Real _z   )
{
	writeTabs();
	m_ribFile<<"Translate "<<_x<<" "<<_y<<" "<<_z<<std::endl;
}
Пример #19
0
//----------------------------------------------------------------------------------------------------------------------
void RibExport::writeToFile( std::string _string   )
{
	writeTabs();
	m_ribFile<<_string<<std::endl;
}