#include <boost/regex.hpp>
#include <boost/filesystem/operations.hpp>
#include <fstream>
-namespace fs = boost::filesystem;
-using lyx::textclass_type;
-using lyx::support::libFileSearch;
-using lyx::support::makeDisplayPath;
+namespace lyx {
+namespace fs = boost::filesystem;
+
+using support::libFileSearch;
+using support::makeDisplayPath;
using boost::bind;
using boost::regex;
if (real_file.empty()) {
lyxerr << "LyXTextClassList::Read: unable to find "
- "textclass file `" << makeDisplayPath(real_file, 1000)
+ "textclass file `" << to_utf8(makeDisplayPath(real_file, 1000))
<< "'. Exiting." << endl;
return false;
// This causes LyX to end... Not a desirable behaviour. Lgb
if (!lex.isOK()) {
lyxerr << "LyXTextClassList::Read: unable to open "
- "textclass file `" << makeDisplayPath(real_file, 1000)
+ "textclass file `" << to_utf8(makeDisplayPath(real_file, 1000))
<< "'\nCheck your installation. LyX can't continue."
<< endl;
return false;
}
-std::pair<bool, lyx::textclass_type> const
+std::pair<bool, textclass_type> const
LyXTextClassList::addTextClass(std::string const & textclass, std::string const & path)
{
// only check for textclass.layout file, .cls can be anywhere in $TEXINPUTS
//
// This is a C++ version of function processLayoutFile in configure.py,
// which uses the following regex
- // \Declare(LaTeX|DocBook|LinuxDoc)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}
+ // \Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}
ifstream ifs(layout_file.c_str());
- static regex const reg("^#\\s*\\\\Declare(LaTeX|DocBook|LinuxDoc)Class\\s*"
+ static regex const reg("^#\\s*\\\\Declare(LaTeX|DocBook)Class\\s*"
"(?:\\[([^,]*)(?:,.*)*\\])*\\s*\\{(.*)\\}\\s*");
string line;
while (getline(ifs, line)) {
// Reads the style files
-void LyXSetStyle()
+bool LyXSetStyle()
{
lyxerr[Debug::TCLASS] << "LyXSetStyle: parsing configuration..." << endl;
if (!textclasslist.read()) {
lyxerr[Debug::TCLASS] << "LyXSetStyle: an error occured "
"during parsing.\n Exiting." << endl;
- exit(1);
+ return false;
}
lyxerr[Debug::TCLASS] << "LyXSetStyle: configuration parsed." << endl;
+ return true;
}
+
+
+} // namespace lyx