using lyx::support::FileFilterList;
using lyx::support::FileSearch;
using lyx::support::ForkedcallsController;
-using lyx::support::IsDirWriteable;
+using lyx::support::isDirWriteable;
using lyx::support::MakeDisplayPath;
using lyx::support::MakeAbsPath;
using lyx::support::package;
if (available()) {
string const trypath = owner_->buffer()->filePath();
// If directory is writeable, use this as default.
- if (IsDirWriteable(trypath))
+ if (isDirWriteable(trypath))
initpath = trypath;
}
#include <sstream>
-using lyx::support::IsSGMLFilename;
+using lyx::support::isSGMLFilename;
using lyx::support::LibFileSearch;
using lyx::support::MakeRelPath;
using lyx::support::OnlyPath;
for (FileMap::const_iterator fi = IncludedFiles_.begin();
fi != end; ++fi)
sgmlpreamble << "\n<!ENTITY " << fi->first
- << (IsSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
+ << (isSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
<< MakeRelPath(fi->second, basename) << "\">";
return sgmlpreamble.str();
using lyx::support::createBufferTmpDir;
using lyx::support::destroyDir;
using lyx::support::getFormatFromContents;
-using lyx::support::IsDirWriteable;
+using lyx::support::isDirWriteable;
using lyx::support::LibFileSearch;
using lyx::support::latex_path;
using lyx::support::ltrim;
}
space_inserted = true;
}
- } else if (!IsPrintable(*cit)) {
+ } else if (!isPrintable(*cit)) {
// Ignore unprintables
continue;
} else {
using lyx::support::contains;
using lyx::support::DirList;
using lyx::support::GetExtension;
-using lyx::support::IsFileReadable;
+using lyx::support::isFileReadable;
using lyx::support::LibFileSearch;
using lyx::support::LibScriptSearch;
using lyx::support::MakeRelPath;
<< command << endl;
Systemcall one;
one.startscript(Systemcall::Wait, command);
- if (IsFileReadable(to_file)) {
+ if (isFileReadable(to_file)) {
return true;
}
}
using support::AddName;
using support::FileFilterList;
-using support::IsFileReadable;
+using support::isFileReadable;
using support::MakeAbsPath;
using support::package;
using support::readBB_from_PSFile;
{
// It may be that the filename is relative.
string const name = MakeAbsPath(fname, kernel().bufferFilepath());
- return IsFileReadable(name);
+ return isFileReadable(name);
}
namespace lyx {
using support::FileFilterList;
-using support::IsFileReadable;
+using support::isFileReadable;
using support::MakeAbsPath;
using support::OnlyPath;
= MakeAbsPath(file,
OnlyPath(kernel().buffer().fileName()));
- if (IsFileReadable(fileWithAbsPath))
+ if (isFileReadable(fileWithAbsPath))
return true;
return false;
Paragraph::value_type const c =
cur.paragraph().getChar(cur.pos());
word += c;
- if (IsDigit(c))
+ if (isDigit(c))
ignoreword = true;
}
} else { // !isLetter(cur)
filename = lyx::support::ChangeExtension(name, ".glade");
filename = lyx::support::AddName(dir, filename);
- if (!lyx::support::IsFileReadable(filename)) {
+ if (!lyx::support::isFileReadable(filename)) {
lyxerr << "Unable to find glade file \"" << name
<< "\". libglade is going to crash..." << std::endl;
}
using support::ChangeExtension;
using support::FileMonitor;
-using support::IsFileReadable;
+using support::isFileReadable;
using support::MakeDisplayPath;
using support::OnlyFilename;
using support::tempName;
converter_.reset();
cc_.disconnect();
- success = !file_to_load_.empty() && IsFileReadable(file_to_load_);
+ success = !file_to_load_.empty() && isFileReadable(file_to_load_);
if (!success) {
lyxerr[Debug::GRAPHICS] << "Unable to find converted file!"
setStatus(Converting);
// First, check that the file exists!
- if (!IsFileReadable(filename_)) {
+ if (!isFileReadable(filename_)) {
if (status_ != ErrorNoFile) {
setStatus(ErrorNoFile);
lyxerr[Debug::GRAPHICS]
string const file = result.substr(pos + 12, end - (pos + 12));
string contents;
- string const filepath = support::IsFileReadable(file) ?
+ string const filepath = support::isFileReadable(file) ?
buffer.filePath() : m_buffer->temppath();
support::Path p(filepath);
- if (support::IsFileReadable(file))
+ if (support::isFileReadable(file))
contents = support::GetFileContents(file);
result = support::subst(result,
using lyx::support::copy;
using lyx::support::FileName;
using lyx::support::findtexfile;
-using lyx::support::IsFileReadable;
+using lyx::support::isFileReadable;
using lyx::support::latex_path;
using lyx::support::ltrim;
using lyx::support::MakeAbsPath;
string const & name, string const & ext)
{
string const fname = MakeAbsPath(name, buffer.filePath());
- if (AbsolutePath(name) || !IsFileReadable(fname + ext))
+ if (AbsolutePath(name) || !isFileReadable(fname + ext))
return name;
else if (!runparams.nice)
return fname;
string const in_file = database + ".bib";
if (!runparams.inComment && !runparams.nice &&
- IsFileReadable(in_file)) {
+ isFileReadable(in_file)) {
// mangledFilename() needs the extension
database = removeExtension(FileName(in_file).mangledFilename());
// This prevents problems with spaces and 8bit charcaters
// in the file name.
if (!runparams.inComment && !runparams.nice &&
- IsFileReadable(in_file)) {
+ isFileReadable(in_file)) {
// use new style name
base = removeExtension(
FileName(in_file).mangledFilename());
string const included_file = params.filename.absFilename();
return params.display == external::PreviewDisplay &&
- support::IsFileReadable(included_file);
+ support::isFileReadable(included_file);
}
using lyx::support::FileName;
using lyx::support::float_equal;
using lyx::support::GetExtension;
-using lyx::support::IsFileReadable;
+using lyx::support::isFileReadable;
using lyx::support::latex_path;
using lyx::support::OnlyFilename;
using lyx::support::removeExtension;
// not exist.
// We are not going to change the extension or using the name of the
// temporary file, the code is already complicated enough.
- if (runparams.inComment || !IsFileReadable(orig_file))
+ if (runparams.inComment || !isFileReadable(orig_file))
return params().filename.outputFilename(m_buffer->filePath());
// We place all temporary files in the master buffer's temp dir.
params().filename.relFilename(buf.filePath());
string const file_ = params().filename.absFilename();
- bool const file_exists = !file_.empty() && IsFileReadable(file_);
+ bool const file_exists = !file_.empty() && isFileReadable(file_);
string const message = file_exists ?
string() : string("bb = 0 0 200 100, draft, type=eps");
// if !message.empty() then there was no existing file
using lyx::support::copy;
using lyx::support::FileName;
using lyx::support::GetFileContents;
-using lyx::support::IsFileReadable;
-using lyx::support::IsLyXFilename;
+using lyx::support::isFileReadable;
+using lyx::support::isLyXFilename;
using lyx::support::latex_path;
using lyx::support::MakeAbsPath;
using lyx::support::MakeDisplayPath;
return false;
string const included_file = includedFilename(buffer, params);
- if (!IsLyXFilename(included_file))
+ if (!isLyXFilename(included_file))
return false;
Buffer * buf = bufferlist.getBuffer(included_file);
exportfile);
// \input wants file with extension (default is .tex)
- if (!IsLyXFilename(included_file)) {
+ if (!isLyXFilename(included_file)) {
incfile = latex_path(incfile);
os << '\\' << params_.getCmdName() << '{' << incfile << '}';
} else {
string const included_file = includedFilename(buffer, params_);
- if (IsLyXFilename(included_file))
+ if (isLyXFilename(included_file))
writefile = ChangeExtension(included_file, ".sgml");
else
writefile = included_file;
string const included_file = includedFilename(buffer, params);
return type(params) == INPUT && params.preview() &&
- IsFileReadable(included_file);
+ isFileReadable(included_file);
}
using lyx::support::destroyDir;
using lyx::support::FileFilterList;
using lyx::support::ForkedProcess;
-using lyx::support::IsLyXFilename;
+using lyx::support::isLyXFilename;
using lyx::support::LibFileSearch;
using lyx::support::MakeAbsPath;
using lyx::support::MakeDisplayPath;
make_pair(string(_("Templates|#T#t")),
string(lyxrc.template_path)));
- if (!IsLyXFilename(fname))
+ if (!isLyXFilename(fname))
fname += ".lyx";
FileFilterList const filter (_("LyX Documents (*.lyx)"));
// Make sure the absolute filename ends with appropriate suffix
fname = MakeAbsPath(fname);
- if (!IsLyXFilename(fname))
+ if (!isLyXFilename(fname))
fname += ".lyx";
} else
fname = filename;
using lyx::support::FileSearch;
using lyx::support::ForkedcallsController;
using lyx::support::i18nLibFileSearch;
-using lyx::support::IsDirWriteable;
-using lyx::support::IsFileReadable;
+using lyx::support::isDirWriteable;
+using lyx::support::isFileReadable;
using lyx::support::isStrInt;
using lyx::support::MakeAbsPath;
using lyx::support::MakeDisplayPath;
else if (name == "character" || name == "mathpanel")
enable = cur.inset().lyxCode() != InsetBase::ERT_CODE;
else if (name == "latexlog")
- enable = IsFileReadable(buf->getLogName().second);
+ enable = isFileReadable(buf->getLogName().second);
#if !defined (USE_ASPELL) && !defined (USE_ISPELL) && !defined (USE_PSPELL)
else if (name == "spellchecker")
enable = false;
if (view()->available()) {
string const trypath = owner->buffer()->filePath();
// If directory is writeable, use this as default.
- if (IsDirWriteable(trypath))
+ if (isDirWriteable(trypath))
initpath = trypath;
}
if (view()->available()) {
string const trypath = owner->buffer()->filePath();
// If directory is writeable, use this as default.
- if (IsDirWriteable(trypath))
+ if (isDirWriteable(trypath))
initpath = trypath;
}
if (view()->available()) {
string const trypath = owner->buffer()->filePath();
// If directory is writeable, use this as default.
- if (IsDirWriteable(trypath))
+ if (isDirWriteable(trypath))
initpath = trypath;
}
// Reads a textclass structure from file.
bool LyXTextClass::Read(string const & filename, bool merge)
{
- if (!lyx::support::IsFileReadable(filename)) {
+ if (!lyx::support::isFileReadable(filename)) {
lyxerr << "Cannot read layout file `" << filename << "'."
<< endl;
return true;
#include "support/lyxlib.h"
using lyx::support::bformat;
-using lyx::support::IsFileReadable;
+using lyx::support::isFileReadable;
using lyx::support::MakeDisplayPath;
using lyx::support::tempName;
string const filename = owner_->fileName();
// there must be a file to save
- if (!IsFileReadable(filename)) {
+ if (!isFileReadable(filename)) {
Alert::error(_("Document not saved"),
_("You must save the document "
"before it can be registered."));
if (!vcs) {
string const cvs_entries = "CVS/Entries";
- if (IsFileReadable(cvs_entries)) {
+ if (isFileReadable(cvs_entries)) {
lyxerr[Debug::LYXVC]
<< "LyXVC: registering "
<< MakeDisplayPath(filename)
bool Paragraph::isLineSeparator(pos_type pos) const
{
value_type const c = getChar(pos);
- return IsLineSeparatorChar(c)
+ return isLineSeparatorChar(c)
|| (c == Paragraph::META_INSET && getInset(pos) &&
getInset(pos)->isLineSeparator());
}
return getInset(pos)->isLetter();
else {
value_type const c = getChar(pos);
- return IsLetterChar(c) || IsDigit(c);
+ return isLetterChar(c) || isDigit(c);
}
}
for (pos_type i = 0; i < size(); ++i) {
value_type c = getChar(i);
- if (IsPrintable(c))
+ if (isPrintable(c))
s += c;
else if (c == META_INSET &&
getInset(i)->lyxCode() == InsetBase::MATH_CODE) {
for (pos_type i = beg; i < end; ++i) {
value_type const c = getUChar(buffer.params(), i);
- if (IsPrintable(c))
+ if (isPrintable(c))
os << c;
else if (c == META_INSET)
getInset(i)->textString(buffer, os, runparams);
unsigned char Paragraph::transformChar(unsigned char c, pos_type pos) const
{
if (!Encodings::is_arabic(c))
- if (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 && IsDigit(c))
+ if (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 && isDigit(c))
return c + (0xb0 - '0');
else
return c;
for (pos_type i = pos - 1; i >= 0; --i) {
c = par_.getChar(i);
if (!Encodings::IsComposeChar_hebrew(c)) {
- if (IsPrintableNonspace(c)) {
+ if (isPrintableNonspace(c)) {
int const width2 =
text_.singleWidth(par_, i, c, text_.getFont(par_, i));
// dalet / resh
for (pos_type i = pos - 1; i >= 0; --i) {
c = par_.getChar(i);
if (!Encodings::IsComposeChar_arabic(c)) {
- if (IsPrintableNonspace(c)) {
+ if (isPrintableNonspace(c)) {
int const width2 =
text_.singleWidth(par_, i, c, text_.getFont(par_, i));
dx = (width2 - width) / 2;
char c = par_.getChar(pos);
- if (!IsPrintableNonspace(c))
+ if (!isPrintableNonspace(c))
break;
if (arabic && Encodings::IsComposeChar_arabic(c))
namespace lyx {
namespace support {
-bool IsLyXFilename(string const & filename)
+bool isLyXFilename(string const & filename)
{
return suffixIs(ascii_lowercase(filename), ".lyx");
}
-bool IsSGMLFilename(string const & filename)
+bool isSGMLFilename(string const & filename)
{
return suffixIs(ascii_lowercase(filename), ".sgml");
}
// Is a file readable ?
-bool IsFileReadable(string const & path)
+bool isFileReadable(string const & path)
{
return fs::exists(path) && !fs::is_directory(path) && fs::is_readable(path);
}
//returns true: dir writeable
// false: not writeable
-bool IsDirWriteable(string const & path)
+bool isDirWriteable(string const & path)
{
- lyxerr[Debug::FILES] << "IsDirWriteable: " << path << endl;
+ lyxerr[Debug::FILES] << "isDirWriteable: " << path << endl;
string const tmpfl = tempName(path, "lyxwritetest");
string const tmpname = ReplaceEnvironmentPath(name);
string fullname = MakeAbsPath(tmpname, path);
// search first without extension, then with it.
- if (IsFileReadable(fullname))
+ if (isFileReadable(fullname))
return fullname;
if (ext.empty())
return string();
// Is it not more reasonable to use ChangeExtension()? (SMiyata)
fullname += '.';
fullname += ext;
- return IsFileReadable(fullname) ? fullname : string();
+ return isFileReadable(fullname) ? fullname : string();
}
#ifdef __EMX__
Path p(package().user_support());
#endif
- if (IsDirWriteable(deflt)) {
+ if (isDirWriteable(deflt)) {
// deflt could not be created because it
// did exist already, so let's create our own
// dir inside deflt.
string const getFormatFromContents(string const & filename)
{
// paranoia check
- if (filename.empty() || !IsFileReadable(filename))
+ if (filename.empty() || !isFileReadable(filename))
return string();
ifstream ifs(filename.c_str());
true: dir writeable
false: not writeable
*/
-bool IsDirWriteable (std::string const & path);
+bool isDirWriteable (std::string const & path);
/** Is a file readable ?
Returns true if the file `path' is readable.
*/
-bool IsFileReadable (std::string const & path);
+bool isFileReadable (std::string const & path);
///
-bool IsLyXFilename(std::string const & filename);
+bool isLyXFilename(std::string const & filename);
///
-bool IsSGMLFilename(std::string const & filename);
+bool isSGMLFilename(std::string const & filename);
/** Returns the path of a library data file.
Search the file name.ext in the subdirectory dir of
/// return true if the char is a line separator
inline
-bool IsLineSeparatorChar(char c)
+bool isLineSeparatorChar(char c)
{
return c == ' ';
}
/// return true if a char is alphabetical (including accented chars)
inline
-bool IsLetterChar(unsigned char c)
+bool isLetterChar(unsigned char c)
{
return (c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z')
/// return true if the char is printable (masked to 7-bit ASCII)
inline
-bool IsPrintable(unsigned char c)
+bool isPrintable(unsigned char c)
{
return (c & 127) >= ' ';
}
/// return true if the char is printable and not a space (masked to 7-bit ASCII)
inline
-bool IsPrintableNonspace(unsigned char c)
+bool isPrintableNonspace(unsigned char c)
{
- return IsPrintable(c) && c != ' ';
+ return isPrintable(c) && c != ' ';
}
/// completely pointless FIXME
inline
-bool IsDigit(unsigned char ch)
+bool isDigit(unsigned char ch)
{
return ch >= '0' && ch <= '9';
}
using lyx::support::MakeAbsPath;
using lyx::support::OnlyPath;
using lyx::support::rtrim;
-using lyx::support::IsFileReadable;
+using lyx::support::isFileReadable;
namespace fs = boost::filesystem;
bool tex2lyx(string const &infilename, string const &outfilename)
{
- if (IsFileReadable(outfilename)) {
+ if (isFileReadable(outfilename)) {
if (overwrite_files) {
cerr << "Overwriting existing file "
<< outfilename << endl;
pos_type pos, char c, LyXFont const & font) const
{
// The most common case is handled first (Asger)
- if (IsPrintable(c)) {
+ if (isPrintable(c)) {
Language const * language = font.language();
if (language->RightToLeft()) {
if ((lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
static string const number_seperators = ".,:";
if (current_font.number() == LyXFont::ON) {
- if (!IsDigit(c) && !contains(number_operators, c) &&
+ if (!isDigit(c) && !contains(number_operators, c) &&
!(contains(number_seperators, c) &&
cur.pos() != 0 &&
cur.pos() != cur.lastpos() &&
getFont(par, cur.pos() - 1).number() == LyXFont::ON)
)
number(cur); // Set current_font.number to OFF
- } else if (IsDigit(c) &&
+ } else if (isDigit(c) &&
real_current_font.isVisibleRightToLeft()) {
number(cur); // Set current_font.number to ON
// When the free-spacing option is set for the current layout,
// disable the double-space checking
- if (!freeSpacing && IsLineSeparatorChar(c)) {
+ if (!freeSpacing && isLineSeparatorChar(c)) {
if (cur.pos() == 0) {
static bool sent_space_message = false;
if (!sent_space_message) {
linestr[i] = ' ';
newline_inserted = true;
}
- } else if (IsPrintable(linestr[i])) {
+ } else if (isPrintable(linestr[i])) {
newline_inserted = false;
}
}