From Alex Gorbatchev
SyntaxHighlighter is open source and needs your donations. Please download and follow @syntaxhighlight on Twitter.
[edit] C++ Example
/* $Id: main.cpp,v 1.1 2004/01/25 22:57:25 zongo Exp $
**
** Ark - Libraries, Tools & Programs for MORPG developpements.
** Copyright (C) 1999-2004 The Contributors of the Ark Project
** Please see the file "AUTHORS" for a list of contributors
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <iostream>
#include <sstream>
#include <string>
#include "xmlRead.h"
#include "ogreGeometryReader.h"
#include "ogreMeshReader.h"
/****************************************************************************/
class OgreSkeletonReader
{
std::ostream& errors;
public:
OgreSkeletonReader(std::ostream& e) : errors(e) {}
void parse(XmlNode& root)
{
}
bool write(std::ostream& os)
{
return true;
}
};
/****************************************************************************/
void parseStory (XmlNode& node)
{
for (XmlNode cur=node.firstChild() ; cur ; cur=cur.nextSibling())
{
if (cur.isName("keyword"))
{
std::string key = cur.getString();
std::cout << "keyword: " << key << std::endl;
}
}
}
void parseDocument(const char *filename)
{
XmlDocument doc(filename);
if (!doc)
{
std::cerr << "Document not parsed successfully." << std::endl;
return;
}
XmlNode root(doc);
if (!root)
{
std::cerr << "Empty document." << std::endl;
return;
}
if (root.isName("mesh"))
{
MeshParameters defaults;
OgreMeshReader mesh(std::cerr, defaults);
mesh.parseMesh(root);
mesh.write(std::cout);
}
else if (root.isName("skeleton"))
{
OgreSkeletonReader skel(std::cerr);
skel.parse(root);
skel.write(std::cout);
}
else
{
std::cerr << "Unsupported XML file." << std::endl;
}
}
int main(int argc, char **argv)
{
if (argc <= 1)
{
std::cerr << "Usage: " << argv[0] << " file.xml" << std::endl;
return -1;
}
const char* filename = argv[1];
parseDocument(filename);
return 0;
}
| Brush name | Brush aliases | File name |
|---|---|---|
| ActionScript3 | as3, actionscript3 | shBrushAS3.js |
| Bash/shell | bash, shell | shBrushBash.js |
| ColdFusion | cf, coldfusion | shBrushColdFusion.js |
| C# | c-sharp, csharp | shBrushCSharp.js |
| C++ | cpp, c | shBrushCpp.js |
| CSS | css | shBrushCss.js |
| Delphi | delphi, pas, pascal | shBrushDelphi.js |
| Diff | diff, patch | shBrushDiff.js |
| Erlang | erl, erlang | shBrushErlang.js |
| Groovy | groovy | shBrushGroovy.js |
| JavaScript | js, jscript, javascript | shBrushJScript.js |
| Java | java | shBrushJava.js |
| JavaFX | jfx, javafx | shBrushJavaFX.js |
| Perl | perl, pl | shBrushPerl.js |
| PHP | php | shBrushPhp.js |
| Plain Text | plain, text | shBrushPlain.js |
| PowerShell | ps, powershell | shBrushPowerShell.js |
| Python | py, python | shBrushPython.js |
| Ruby | rails, ror, ruby | shBrushRuby.js |
| Scala | scala | shBrushScala.js |
| SQL | sql | shBrushSql.js |
| Visual Basic | vb, vbnet | shBrushVb.js |
| XML | xml, xhtml, xslt, html, xhtml | shBrushXml.js |