mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
support/textutils.h:
support/filetools.h: rename IsDirWriteable IsFileReadable IsLyXFilename IsSGMLFilename IsLineSeparatorChar IsLetterChar IsPrintable IsPrintableNonspace IsDigit to lower case initial lyxvc.C: LaTeXFeatures.C: lyx_cb.C: insets/insetbibtex.C: insets/insetexternal.C: insets/insetgraphics.C: insets/ExternalSupport.C: insets/insetinclude.C: BufferView_pimpl.C: graphics/GraphicsCacheItem.C: text2.C: converter.C: buffer.C: lyxfunc.C: frontends/gtk/ghelpers.C: frontends/controllers/ControlGraphics.C: frontends/controllers/ControlInclude.C: frontends/controllers/ControlSpellchecker.C: support/filetools.C: support/filetools.h: adjust git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13595 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
218dc64141
commit
1f5c5a06ee
@ -89,7 +89,7 @@ using lyx::support::bformat;
|
||||
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;
|
||||
@ -907,7 +907,7 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filenm)
|
||||
if (available()) {
|
||||
string const trypath = owner_->buffer()->filePath();
|
||||
// If directory is writeable, use this as default.
|
||||
if (IsDirWriteable(trypath))
|
||||
if (isDirWriteable(trypath))
|
||||
initpath = trypath;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using lyx::support::IsSGMLFilename;
|
||||
using lyx::support::isSGMLFilename;
|
||||
using lyx::support::LibFileSearch;
|
||||
using lyx::support::MakeRelPath;
|
||||
using lyx::support::OnlyPath;
|
||||
@ -509,7 +509,7 @@ string const LaTeXFeatures::getIncludedFiles(string const & fname) const
|
||||
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();
|
||||
|
@ -101,7 +101,7 @@ using lyx::support::cmd_ret;
|
||||
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;
|
||||
@ -531,7 +531,7 @@ void Buffer::insertStringAsLines(ParagraphList & pars,
|
||||
}
|
||||
space_inserted = true;
|
||||
}
|
||||
} else if (!IsPrintable(*cit)) {
|
||||
} else if (!isPrintable(*cit)) {
|
||||
// Ignore unprintables
|
||||
continue;
|
||||
} else {
|
||||
|
@ -36,7 +36,7 @@ using lyx::support::compare_ascii_no_case;
|
||||
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;
|
||||
@ -310,7 +310,7 @@ bool Converters::convert(Buffer const * buffer,
|
||||
<< command << endl;
|
||||
Systemcall one;
|
||||
one.startscript(Systemcall::Wait, command);
|
||||
if (IsFileReadable(to_file)) {
|
||||
if (isFileReadable(to_file)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ namespace lyx {
|
||||
|
||||
using support::AddName;
|
||||
using support::FileFilterList;
|
||||
using support::IsFileReadable;
|
||||
using support::isFileReadable;
|
||||
using support::MakeAbsPath;
|
||||
using support::package;
|
||||
using support::readBB_from_PSFile;
|
||||
@ -133,7 +133,7 @@ bool ControlGraphics::isFilenameValid(string const & fname) const
|
||||
{
|
||||
// It may be that the filename is relative.
|
||||
string const name = MakeAbsPath(fname, kernel().bufferFilepath());
|
||||
return IsFileReadable(name);
|
||||
return isFileReadable(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ using std::string;
|
||||
namespace lyx {
|
||||
|
||||
using support::FileFilterList;
|
||||
using support::IsFileReadable;
|
||||
using support::isFileReadable;
|
||||
using support::MakeAbsPath;
|
||||
using support::OnlyPath;
|
||||
|
||||
@ -114,7 +114,7 @@ bool ControlInclude::fileExists(string const & file)
|
||||
= MakeAbsPath(file,
|
||||
OnlyPath(kernel().buffer().fileName()));
|
||||
|
||||
if (IsFileReadable(fileWithAbsPath))
|
||||
if (isFileReadable(fileWithAbsPath))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -161,7 +161,7 @@ WordLangTuple nextWord(DocIterator & cur, ptrdiff_t & progress,
|
||||
Paragraph::value_type const c =
|
||||
cur.paragraph().getChar(cur.pos());
|
||||
word += c;
|
||||
if (IsDigit(c))
|
||||
if (isDigit(c))
|
||||
ignoreword = true;
|
||||
}
|
||||
} else { // !isLetter(cur)
|
||||
|
@ -257,7 +257,7 @@ string const findGladeFile(string const & name)
|
||||
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;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace support = lyx::support;
|
||||
|
||||
using support::ChangeExtension;
|
||||
using support::FileMonitor;
|
||||
using support::IsFileReadable;
|
||||
using support::isFileReadable;
|
||||
using support::MakeDisplayPath;
|
||||
using support::OnlyFilename;
|
||||
using support::tempName;
|
||||
@ -267,7 +267,7 @@ void CacheItem::Impl::imageConverted(bool success)
|
||||
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!"
|
||||
@ -378,7 +378,7 @@ void CacheItem::Impl::convertToDisplayFormat()
|
||||
setStatus(Converting);
|
||||
|
||||
// First, check that the file exists!
|
||||
if (!IsFileReadable(filename_)) {
|
||||
if (!isFileReadable(filename_)) {
|
||||
if (status_ != ErrorNoFile) {
|
||||
setStatus(ErrorNoFile);
|
||||
lyxerr[Debug::GRAPHICS]
|
||||
|
@ -172,11 +172,11 @@ string const doSubstitution(InsetExternalParams const & params,
|
||||
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,
|
||||
|
@ -43,7 +43,7 @@ using lyx::support::contains;
|
||||
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;
|
||||
@ -112,7 +112,7 @@ string normalize_name(Buffer const & buffer, OutputParams const & runparams,
|
||||
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;
|
||||
@ -162,7 +162,7 @@ int InsetBibtex::latex(Buffer const & buffer, ostream & os,
|
||||
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());
|
||||
@ -217,7 +217,7 @@ int InsetBibtex::latex(Buffer const & buffer, ostream & os,
|
||||
// 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());
|
||||
|
@ -801,7 +801,7 @@ bool preview_wanted(InsetExternalParams const & params)
|
||||
string const included_file = params.filename.absFilename();
|
||||
|
||||
return params.display == external::PreviewDisplay &&
|
||||
support::IsFileReadable(included_file);
|
||||
support::isFileReadable(included_file);
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,7 +98,7 @@ using lyx::support::contains;
|
||||
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;
|
||||
@ -576,7 +576,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
|
||||
// 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.
|
||||
@ -726,7 +726,7 @@ int InsetGraphics::latex(Buffer const & buf, ostream & os,
|
||||
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
|
||||
|
@ -61,8 +61,8 @@ using lyx::support::contains;
|
||||
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;
|
||||
@ -307,7 +307,7 @@ bool loadIfNeeded(Buffer const & buffer, InsetCommandParams const & params)
|
||||
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);
|
||||
@ -417,7 +417,7 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
|
||||
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 {
|
||||
@ -553,7 +553,7 @@ void InsetInclude::validate(LaTeXFeatures & features) const
|
||||
|
||||
string const included_file = includedFilename(buffer, params_);
|
||||
|
||||
if (IsLyXFilename(included_file))
|
||||
if (isLyXFilename(included_file))
|
||||
writefile = ChangeExtension(included_file, ".sgml");
|
||||
else
|
||||
writefile = included_file;
|
||||
@ -692,7 +692,7 @@ bool preview_wanted(InsetCommandParams const & params, Buffer const & buffer)
|
||||
string const included_file = includedFilename(buffer, params);
|
||||
|
||||
return type(params) == INPUT && params.preview() &&
|
||||
IsFileReadable(included_file);
|
||||
isFileReadable(included_file);
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,7 +59,7 @@ using lyx::support::bformat;
|
||||
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;
|
||||
@ -135,7 +135,7 @@ bool WriteAs(Buffer * buffer, string const & filename)
|
||||
make_pair(string(_("Templates|#T#t")),
|
||||
string(lyxrc.template_path)));
|
||||
|
||||
if (!IsLyXFilename(fname))
|
||||
if (!isLyXFilename(fname))
|
||||
fname += ".lyx";
|
||||
|
||||
FileFilterList const filter (_("LyX Documents (*.lyx)"));
|
||||
@ -155,7 +155,7 @@ bool WriteAs(Buffer * buffer, string const & filename)
|
||||
|
||||
// Make sure the absolute filename ends with appropriate suffix
|
||||
fname = MakeAbsPath(fname);
|
||||
if (!IsLyXFilename(fname))
|
||||
if (!isLyXFilename(fname))
|
||||
fname += ".lyx";
|
||||
} else
|
||||
fname = filename;
|
||||
|
@ -110,8 +110,8 @@ using lyx::support::FileFilterList;
|
||||
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;
|
||||
@ -515,7 +515,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
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;
|
||||
@ -1696,7 +1696,7 @@ void LyXFunc::menuNew(string const & name, bool fromTemplate)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1746,7 +1746,7 @@ void LyXFunc::open(string const & fname)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1821,7 +1821,7 @@ void LyXFunc::doImport(string const & argument)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ enum TextClassTags {
|
||||
// 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;
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "support/lyxlib.h"
|
||||
|
||||
using lyx::support::bformat;
|
||||
using lyx::support::IsFileReadable;
|
||||
using lyx::support::isFileReadable;
|
||||
using lyx::support::MakeDisplayPath;
|
||||
using lyx::support::tempName;
|
||||
|
||||
@ -89,7 +89,7 @@ void LyXVC::registrer()
|
||||
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."));
|
||||
@ -100,7 +100,7 @@ void LyXVC::registrer()
|
||||
if (!vcs) {
|
||||
string const cvs_entries = "CVS/Entries";
|
||||
|
||||
if (IsFileReadable(cvs_entries)) {
|
||||
if (isFileReadable(cvs_entries)) {
|
||||
lyxerr[Debug::LYXVC]
|
||||
<< "LyXVC: registering "
|
||||
<< MakeDisplayPath(filename)
|
||||
|
@ -1461,7 +1461,7 @@ bool Paragraph::isNewline(pos_type pos) const
|
||||
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());
|
||||
}
|
||||
@ -1474,7 +1474,7 @@ bool Paragraph::isLetter(pos_type pos) const
|
||||
return getInset(pos)->isLetter();
|
||||
else {
|
||||
value_type const c = getChar(pos);
|
||||
return IsLetterChar(c) || IsDigit(c);
|
||||
return isLetterChar(c) || isDigit(c);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1547,7 +1547,7 @@ string const Paragraph::asString(Buffer const & buffer,
|
||||
|
||||
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) {
|
||||
@ -1586,7 +1586,7 @@ string const Paragraph::asString(Buffer const & buffer,
|
||||
|
||||
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);
|
||||
@ -1811,7 +1811,7 @@ size_t Paragraph::pos2row(pos_type pos) const
|
||||
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;
|
||||
|
@ -196,7 +196,7 @@ void RowPainter::paintHebrewComposeChar(pos_type & vpos, LyXFont const & font)
|
||||
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
|
||||
@ -230,7 +230,7 @@ void RowPainter::paintArabicComposeChar(pos_type & vpos, LyXFont const & font)
|
||||
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;
|
||||
@ -270,7 +270,7 @@ void RowPainter::paintChars(pos_type & vpos, LyXFont font,
|
||||
|
||||
char c = par_.getChar(pos);
|
||||
|
||||
if (!IsPrintableNonspace(c))
|
||||
if (!isPrintableNonspace(c))
|
||||
break;
|
||||
|
||||
if (arabic && Encodings::IsComposeChar_arabic(c))
|
||||
|
@ -70,13 +70,13 @@ namespace fs = boost::filesystem;
|
||||
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");
|
||||
}
|
||||
@ -142,7 +142,7 @@ string const QuoteName(string const & name)
|
||||
|
||||
|
||||
// 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);
|
||||
}
|
||||
@ -150,9 +150,9 @@ bool IsFileReadable(string const & 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");
|
||||
|
||||
@ -246,14 +246,14 @@ string const FileSearch(string const & path, string const & name,
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@ -415,7 +415,7 @@ string const createLyXTmpDir(string const & deflt)
|
||||
#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.
|
||||
@ -797,7 +797,7 @@ string const GetExtension(string const & name)
|
||||
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());
|
||||
|
@ -63,18 +63,18 @@ std::vector<std::string> const DirList(std::string const & dir,
|
||||
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
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
/// return true if the char is a line separator
|
||||
inline
|
||||
bool IsLineSeparatorChar(char c)
|
||||
bool isLineSeparatorChar(char c)
|
||||
{
|
||||
return c == ' ';
|
||||
}
|
||||
@ -26,7 +26,7 @@ bool IsLineSeparatorChar(char 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')
|
||||
@ -36,7 +36,7 @@ bool IsLetterChar(unsigned char c)
|
||||
|
||||
/// 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) >= ' ';
|
||||
}
|
||||
@ -44,15 +44,15 @@ bool IsPrintable(unsigned char c)
|
||||
|
||||
/// 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';
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ using lyx::support::ltrim;
|
||||
using lyx::support::MakeAbsPath;
|
||||
using lyx::support::OnlyPath;
|
||||
using lyx::support::rtrim;
|
||||
using lyx::support::IsFileReadable;
|
||||
using lyx::support::isFileReadable;
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
@ -450,7 +450,7 @@ bool tex2lyx(string const &infilename, std::ostream &os)
|
||||
|
||||
bool tex2lyx(string const &infilename, string const &outfilename)
|
||||
{
|
||||
if (IsFileReadable(outfilename)) {
|
||||
if (isFileReadable(outfilename)) {
|
||||
if (overwrite_files) {
|
||||
cerr << "Overwriting existing file "
|
||||
<< outfilename << endl;
|
||||
|
@ -427,7 +427,7 @@ int LyXText::singleWidth(Paragraph const & par,
|
||||
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 ||
|
||||
@ -1132,7 +1132,7 @@ void LyXText::insertChar(LCursor & cur, char c)
|
||||
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() &&
|
||||
@ -1140,7 +1140,7 @@ void LyXText::insertChar(LCursor & cur, char c)
|
||||
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
|
||||
|
||||
@ -1169,7 +1169,7 @@ void LyXText::insertChar(LCursor & cur, char c)
|
||||
|
||||
// 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) {
|
||||
|
@ -648,7 +648,7 @@ void LyXText::insertStringAsParagraphs(LCursor & cur, string const & str)
|
||||
linestr[i] = ' ';
|
||||
newline_inserted = true;
|
||||
}
|
||||
} else if (IsPrintable(linestr[i])) {
|
||||
} else if (isPrintable(linestr[i])) {
|
||||
newline_inserted = false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user