コード例 #1
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
void RibExport::WorldEnd()
{
	--m_tabs;
	WriteTabs();
	m_ribFile<<"WorldEnd "<<std::endl;
	--m_worldCount;
}
コード例 #2
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
void RibExport::TransformEnd()
{
	--m_tabs;
	WriteTabs();
	m_ribFile<<"TransformEnd "<<std::endl;
	--m_transformCount;
}
コード例 #3
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
void RibExport::AttributeBegin()
{
	WriteTabs();
	m_ribFile<<"AttributeBegin "<<std::endl;
	++m_tabs;
	++m_attribCount;
}
コード例 #4
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
void RibExport::AttributeEnd()
{
	--m_tabs;
	WriteTabs();
	m_ribFile<<"AttributeEnd "<<std::endl;
	m_attribCount--;
}
コード例 #5
0
ファイル: NodeFile.cpp プロジェクト: EQ4/neonv2
//---------------------------------------------------------------------------//
// WriteOpen
//
//---------------------------------------------------------------------------//  
void CNodeFile::WriteNode(const string &sName, const string &sAttribs, bool bValue)
{
  WriteTabs(m_Nodes.size());
  char pBuffer[512];
  sprintf_s(pBuffer, 512, "<%s %s>%d</%s>\r\n", sName.c_str(), sAttribs.c_str(), bValue ? 1 : 0, sName.c_str());
  m_OutFile.WriteLn(pBuffer);
}
コード例 #6
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
void RibExport::WriteToFile(
                            std::string _string
                           )
{
	WriteTabs();
	m_ribFile<<_string<<std::endl;
}
コード例 #7
0
ファイル: NodeFile.cpp プロジェクト: EQ4/neonv2
//---------------------------------------------------------------------------//
// WriteOpen
//
//---------------------------------------------------------------------------//  
void CNodeFile::WriteOpenNode(const string &sName, const string &sAttribs)
{
  WriteTabs(m_Nodes.size());
  string sLine = "<" + sName + " " + sAttribs + ">\r\n";
  m_OutFile.WriteLn(sLine.c_str());
  m_Nodes.push(sName);
}
コード例 #8
0
nsresult
nsLoggingSink::OpenNode(const char* aKind, const nsIParserNode& aNode) {
	WriteTabs(mOutput,++mLevel);

  PR_fprintf(mOutput,"<open container=");

  nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType());
  if ((nodeType >= eHTMLTag_unknown) &&
      (nodeType <= nsHTMLTag(NS_HTML_TAG_MAX))) {
    const PRUnichar* tag = nsHTMLTags::GetStringValue(nodeType);
    PR_fprintf(mOutput, "\"%s\"", NS_ConvertUTF16toUTF8(tag).get());
  }
  else {
    char* text = nsnull;
    GetNewCString(aNode.GetText(), &text);
    if(text) {
      PR_fprintf(mOutput, "\"%s\"", text);
      nsMemory::Free(text);
    }
  }

  if (WillWriteAttributes(aNode)) {
    PR_fprintf(mOutput, ">\n");
    WriteAttributes(aNode);
    PR_fprintf(mOutput, "</open>\n");
  }
  else {
    PR_fprintf(mOutput, ">\n");
  }

  return NS_OK;
}
コード例 #9
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
void RibExport::WorldBegin()
{
	WriteTabs();
	m_ribFile<<"WorldBegin "<<std::endl;
	++m_tabs;
	++m_worldCount;
}
コード例 #10
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
void RibExport::TransformBegin()
{
	WriteTabs();
	m_ribFile<<"TransformBegin "<<std::endl;
	++m_tabs;
	++m_transformCount;
}
コード例 #11
0
ファイル: NodeFile.cpp プロジェクト: EQ4/neonv2
//---------------------------------------------------------------------------//
// WriteOpen
//
//---------------------------------------------------------------------------//  
void CNodeFile::WriteCloseNode()
{
  string sName = m_Nodes.top();
  m_Nodes.pop();
  WriteTabs(m_Nodes.size());
  string sLine = "</" + sName + ">\r\n";
  m_OutFile.WriteLn(sLine.c_str());
}
コード例 #12
0
nsresult
nsLoggingSink::WriteAttributes(const nsIParserNode& aNode) {

  WriteTabs(mOutput,1+mLevel);
  nsAutoString tmp;
  PRInt32 ac = aNode.GetAttributeCount();
  for (PRInt32 i = 0; i < ac; ++i) {
    char* key=nsnull;
    char* value=nsnull;
    const nsAString& k = aNode.GetKeyAt(i);
    const nsAString& v = aNode.GetValueAt(i);

    GetNewCString(k, &key);
    if(key) {
      PR_fprintf(mOutput, " <attr key=\"%s\" value=\"", key);
      nsMemory::Free(key);
    }
 
    tmp.Truncate();
    tmp.Append(v);
    if(!tmp.IsEmpty()) {
      PRUnichar first = tmp.First();
      if ((first == '"') || (first == '\'')) {
        if (tmp.Last() == first) {
          tmp.Cut(0, 1);
          PRInt32 pos = tmp.Length() - 1;
          if (pos >= 0) {
            tmp.Cut(pos, 1);
          }
        } else {
          // Mismatched quotes - leave them in
        }
      }
      GetNewCString(tmp, &value);

      if(value) {
        PR_fprintf(mOutput, "%s\"/>\n", value);
        WriteTabs(mOutput,1+mLevel);
        nsMemory::Free(value);
      }
    }
  }

  WriteTabs(mOutput,1+mLevel);
  return NS_OK;
}
コード例 #13
0
nsresult
nsLoggingSink::LeafNode(const nsIParserNode& aNode)
{
  WriteTabs(mOutput,1+mLevel);
  nsHTMLTag nodeType  = nsHTMLTag(aNode.GetNodeType());

  if ((nodeType >= eHTMLTag_unknown) &&
      (nodeType <= nsHTMLTag(NS_HTML_TAG_MAX))) {
    const PRUnichar* tag = nsHTMLTags::GetStringValue(nodeType);

    if(tag)
      PR_fprintf(mOutput, "<leaf tag=\"%s\"", NS_ConvertUTF16toUTF8(tag).get());
    else
      PR_fprintf(mOutput, "<leaf tag=\"???\"");

    if (WillWriteAttributes(aNode)) {
      PR_fprintf(mOutput, ">\n");
      WriteAttributes(aNode);
      PR_fprintf(mOutput, "</leaf>\n");
    }
    else {
      PR_fprintf(mOutput, "/>\n");
    }
  }
  else {
    PRInt32 pos;
    nsAutoString tmp;
    char* str = nsnull;
    switch (nodeType) {
    case eHTMLTag_whitespace:
    case eHTMLTag_text:
      GetNewCString(aNode.GetText(), &str);
      if(str) {
        PR_fprintf(mOutput, "<text value=\"%s\"/>\n", str);
        nsMemory::Free(str);
      }
      break;

    case eHTMLTag_newline:
      PR_fprintf(mOutput, "<newline/>\n");
      break;

    case eHTMLTag_entity:
      tmp.Append(aNode.GetText());
      tmp.Cut(0, 1);
      pos = tmp.Length() - 1;
      if (pos >= 0) {
        tmp.Cut(pos, 1);
      }
      PR_fprintf(mOutput, "<entity value=\"%s\"/>\n", NS_LossyConvertUTF16toASCII(tmp).get());
      break;

    default:
      NS_NOTREACHED("unsupported leaf node type");
    }//switch
  }
  return NS_OK;
}
コード例 #14
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
void RibExport::Hyperboloid(
                            const Real _p1,
                            const Real _p2,
                            const Real _sweep
                           )
{
	WriteTabs();
	m_ribFile<<"Hyperboloid "<<_p1<<" "<<_p2<<" "<<_sweep<<std::endl;
}
コード例 #15
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
void RibExport::Disk(
                     const Real _height,
                     const Real _radius,
                     const Real _sweep
                    )
{
	WriteTabs();
	m_ribFile<<"Disk "<<_height<<" "<<_radius<<" "<<_sweep<<std::endl;
}
コード例 #16
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
void RibExport::Scale(
                      const Real _x,
                      const Real _y,
                      const Real _z
                     )
{
	WriteTabs();
	m_ribFile<<"Scale "<<_x<<" "<<_y<<" "<<_z<<std::endl;
}
コード例 #17
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
void RibExport::Translate(
                          const Real _x,
                          const Real _y,
                          const Real _z
                         )
{
	WriteTabs();
	m_ribFile<<"Translate "<<_x<<" "<<_y<<" "<<_z<<std::endl;
}
コード例 #18
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
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;
}
コード例 #19
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
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;
}
コード例 #20
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
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;
}
コード例 #21
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
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;
}
コード例 #22
0
ファイル: RibExport.cpp プロジェクト: suncorner/NGL
//----------------------------------------------------------------------------------------------------------------------
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;
}
コード例 #23
0
NS_IMETHODIMP
nsLoggingSink::WillBuildModel() {
  
  WriteTabs(mOutput,++mLevel);
  PR_fprintf(mOutput, "<begin>\n");
  
  //proxy the call to the real sink if you have one.
  if(mSink) {
    mSink->WillBuildModel();
  }

  return NS_OK;
}
コード例 #24
0
NS_IMETHODIMP
nsLoggingSink::OpenHead() {
  WriteTabs(mOutput,++mLevel);
  PR_fprintf(mOutput,"<open container=head>\n");

  nsresult theResult=NS_OK;

  //then proxy the call to the real sink if you have one.
  if(mSink) {
    theResult=mSink->OpenHead();
  }
  
  return theResult;
}
コード例 #25
0
NS_IMETHODIMP
nsLoggingSink::DidBuildModel() {
  
  WriteTabs(mOutput,--mLevel);
  PR_fprintf(mOutput, "</begin>\n");

  //proxy the call to the real sink if you have one.
  nsresult theResult=NS_OK;
  if(mSink) {
    theResult=mSink->DidBuildModel();
  }

  return theResult;
}
コード例 #26
0
nsresult
nsLoggingSink::CloseNode(const char* aKind) {
	WriteTabs(mOutput,mLevel--);
  PR_fprintf(mOutput, "<close container=\"%s\">\n", aKind);
  return NS_OK;
}
コード例 #27
0
/*
================
rvGEWorkspace::WriteWindow

Writes the contents of the given window to the file
================
*/
bool rvGEWorkspace::WriteWindow(idFile *file, int depth, idWindow *window)
{
	idStr				out;
	rvGEWindowWrapper	*wrapper;
	int					i;

	wrapper = rvGEWindowWrapper::GetWrapper(window);

	if (!wrapper) {
		return true;
	}

	if (wrapper->IsDeleted()) {
		return true;
	}

	// Window def header
	WriteTabs(file, depth - 1);

	out = wrapper->WindowTypeToString(wrapper->GetWindowType());
	out.Append(" ");
	file->Write(out, out.Length());

	out = window->GetName();
	file->Write(out, out.Length());
	file->Write("\r\n", 2);

	WriteTabs(file, depth - 1);

	out = "{\r\n";
	file->Write(out, out.Length());
	file->ForceFlush();

	for (i = 0; i < wrapper->GetStateDict().GetNumKeyVals(); i ++) {
		const idKeyValue *key = wrapper->GetStateDict().GetKeyVal(i);

		// Dont write name to the files
		if (!key->GetKey().Icmp("name")) {
			continue;
		}

		WriteTabs(file, depth);

		out = key->GetKey();
		out.Append("\t");
		file->Write(out, out.Length());

		const char *p;

		for (p = key->GetValue().c_str(); *p; p ++) {
			switch (*p) {
				case '\n':
					file->Write("\\n", 2);
					break;

				default:
					file->Write(p, 1);
					break;
			}
		}

		file->Write("\r\n", 2);
	}

	for (i = 0; i < wrapper->GetVariableDict().GetNumKeyVals(); i ++) {
		const idKeyValue *key = wrapper->GetVariableDict().GetKeyVal(i);

		WriteTabs(file, depth);

		out = key->GetKey();
		out.Append("\t");
		out.Append(key->GetValue());
		out.Append("\r\n");

		file->Write(out, out.Length());
	}

	if (wrapper->GetScriptDict().GetNumKeyVals()) {
		file->Write("\r\n", 2);
	}

	for (i = 0; i < wrapper->GetScriptDict().GetNumKeyVals(); i ++) {
		const idKeyValue *key = wrapper->GetScriptDict().GetKeyVal(i);

		WriteTabs(file, depth);

		file->Write(key->GetKey(), key->GetKey().Length());
		file->Write(" ", 1);

		idLexer src(key->GetValue(), key->GetValue().Length(), "", LEXFL_ALLOWMULTICHARLITERALS | LEXFL_NOSTRINGCONCAT | LEXFL_ALLOWBACKSLASHSTRINGCONCAT);
		src.ParseBracedSectionExact(out, depth + 1);

		file->Write(out, out.Length());
		file->Write("\r\n", 2);
		file->Write("\r\n", 2);
	}

	for (i = 0; i < wrapper->GetChildCount(); i ++) {
		idWindow *child = wrapper->GetChild(i);

		WriteWindow(file, depth + 1, child);
	}

	// Window def footer
	WriteTabs(file, depth - 1);

	out = "}\r\n";
	file->Write(out, out.Length());
	file->ForceFlush();

	return true;
}