Compounds | |
| class | lyx::support::contains_functor |
| This should probably we rewritten to be more general. More... | |
| class | lyx::support::FileInfo |
| Use objects of this class to get information about files. More... | |
| class | lyx::support::FileMonitor |
| class | lyx::support::Forkedcall |
| class | lyx::support::ForkedCallQueue |
| class | lyx::support::ForkedcallsController |
| class | lyx::support::ForkedProcess |
| struct | lyx::support::FileMonitor::Impl |
| struct | lyx::support::local_ascii_lowercase |
| struct | lyx::support::local_lowercase |
| struct | lyx::support::local_uppercase |
| class | lyx::support::Murder |
| class | lyx::support::Path |
| Path - utility closs for stackable working directories. More... | |
| class | lyx::support::Systemcall |
| An instance of Class Systemcall represents a single child process. More... | |
Typedefs | |
| typedef std::pair< int, string > | cmd_ret |
Functions | |
| bool | IsLyXFilename (string const &filename) |
| bool | IsSGMLFilename (string const &filename) |
| string const | MakeLatexName (string const &file) |
| Substitutes active latex characters with underscores in filename. More... | |
| string const | QuoteName (string const &name) |
| Put the name in quotes suitable for the current shell. More... | |
| bool | IsFileReadable (string const &path) |
| Is a file readable ? Returns true if the file `path' is readable. More... | |
| int | IsFileWriteable (string const &path) |
| Is file read only? returns 1: read-write 0: read_only -1: error (doesn't exist, no access, anything else). More... | |
| bool | IsDirWriteable (string const &path) |
| Is directory read only? returns true: dir writeable false: not writeable. More... | |
| string const | FileOpenSearch (string const &path, string const &name, string const &ext) |
| Find file by searching several directories. More... | |
| vector< string > const | DirList (string const &dir, string const &ext) |
| Returns a vector of all files in directory dir having extension ext. More... | |
| string const | FileSearch (string const &path, string const &name, string const &ext) |
| Returns the real name of file name in directory path, with optional extension ext. More... | |
| string const | LibFileSearch (string const &dir, string const &name, string const &ext) |
| Returns the path of a library data file. More... | |
| string const | i18nLibFileSearch (string const &dir, string const &name, string const &ext) |
| Same as LibFileSearch(), but tries first to find an internationalized version of the file by prepending $LANG_ to the name. More... | |
| string const | LibScriptSearch (string const &command_in) |
| Takes a command such as "sh $$s/convertDefault.sh file.in file.out" and replaces "$$s/" with the path to the "most important" of LyX's script directories containing this script. More... | |
| string const | GetEnv (string const &envname) |
| string const | GetEnvPath (string const &name) |
| A helper function. More... | |
| int | DeleteAllFilesInDir (string const &path) |
| string const | CreateTmpDir (string const &tempdir, string const &mask) |
| int | destroyDir (string const &tmpdir) |
| remove directory and all contents, returns 0 on success. More... | |
| string const | CreateBufferTmpDir (string const &pathfor) |
| string const | CreateLyXTmpDir (string const &deflt) |
| bool | createDirectory (string const &path, int permission) |
| Creates directory. Returns true on success. More... | |
| string const | OnlyPath (string const &Filename) |
| Strip filename from path name. More... | |
| string const | MakeAbsPath (string const &RelPath, string const &BasePath) |
| Convert relative path into absolute path based on a basepath. More... | |
| string const | AddName (string const &path, string const &fname) |
| Add a filename to a path. Any path from filename is stripped first. More... | |
| string const | OnlyFilename (string const &fname) |
| Strips path from filename. More... | |
| bool | AbsolutePath (string const &path) |
| Returns true is path is absolute. More... | |
| string const | ExpandPath (string const &path) |
| Create absolute path. If impossible, don't do anything. More... | |
| string const | NormalizePath (string const &path) |
| Normalize a path. More... | |
| string const | GetFileContents (string const &fname) |
| Get the contents of a file as a huge string. More... | |
| string const | ReplaceEnvironmentPath (string const &path) |
| Check and Replace Environmentvariables ${NAME} in Path. More... | |
| string const | MakeRelPath (string const &abspath, string const &basepath) |
| Makes relative path out of absolute path. More... | |
| string const | AddPath (string const &path, string const &path_2) |
| Append sub-directory(ies) to path in an intelligent way. More... | |
| string const | ChangeExtension (string const &oldname, string const &extension) |
| Change extension of oldname to extension. More... | |
| string const | GetExtension (string const &name) |
| Return the extension of the file (not including the .). More... | |
| string const | getExtFromContents (string const &filename) |
| Return the type of the file as an extension from contents. More... | |
| bool | zippedFile (string const &name) |
| check for zipped file. More... | |
| string const | unzipFile (string const &zipped_file) |
| unzip a file. More... | |
| string const | MakeDisplayPath (string const &path, unsigned int threshold) |
| Creates a nice compact path for displaying. More... | |
| bool | LyXReadLink (string const &file, string &link, bool resolve) |
| cmd_ret const | RunCommand (string const &cmd) |
| string const | findtexfile (string const &fil, string const &) |
| Uses kpsewhich to find tex files. More... | |
| void | removeAutosaveFile (string const &filename) |
| remove the autosave-file and give a Message if it can't be done. More... | |
| void | readBB_lyxerrMessage (string const &file, bool &zipped, string const &message) |
| string const | readBB_from_PSFile (string const &file) |
| read the BoundingBox entry from a ps/eps/pdf-file. More... | |
| string const | copyFileToDir (string const &path, string const &file_in) |
Copy file to directory path. More... | |
| void | Assert (bool) |
| Dummy assertion. More... | |
| int | compare_no_case (string const &s, string const &s2) |
| int | ascii_tolower (int c) |
| int | compare_ascii_no_case (string const &s, string const &s2) |
| int | compare_no_case (string const &s, string const &s2, unsigned int len) |
| bool | isStrInt (string const &str) |
| bool | isStrUnsignedInt (string const &str) |
| does the string represent an unsigned integer value ? More... | |
| int | strToInt (string const &str) |
| unsigned int | strToUnsignedInt (string const &str) |
| convert string to an unsigned integer. More... | |
| bool | isStrDbl (string const &str) |
| double | strToDbl (string const &str) |
| char | lowercase (char c) |
| char | uppercase (char c) |
| string const | lowercase (string const &a) |
| string const | uppercase (string const &a) |
| string const | ascii_lowercase (string const &a) |
| same as lowercase(), but ignores locale. More... | |
| bool | prefixIs (string const &a, string const &pre) |
| Does the string start with this prefix? More... | |
| bool | suffixIs (string const &a, char c) |
| Does the string end with this char? More... | |
| bool | suffixIs (string const &a, string const &suf) |
| Does the string end with this suffix? More... | |
| bool | contains (string const &a, string const &b) |
| bool | contains (string const &a, char b) |
| bool | containsOnly (string const &s, string const &cset) |
| string const | token (string const &a, char delim, int n) |
| Extracts a token from this string at the nth delim. More... | |
| int | tokenPos (string const &a, char delim, string const &tok) |
| Search a token in this string using the delim. More... | |
| bool | regexMatch (string const &a, string const &pattern) |
| Compares a string and a (simple) regular expression The only element allowed is "*" for any string of characters. More... | |
| string const | subst (string const &a, char oldchar, char newchar) |
| Substitute all oldchar with newchar. More... | |
| string const | subst (string const &a, string const &oldstr, string const &newstr) |
| substitutes all instances of oldstr with newstr. More... | |
| string const | trim (string const &a, char const *p) |
| Trims characters off the end and beginning of a string. More... | |
| string const | rtrim (string const &a, char const *p) |
| Trims characters off the end of a string. More... | |
| string const | ltrim (string const &a, char const *p) |
| Trims characters off the beginning of a string. More... | |
| string const | split (string const &a, string &piece, char delim) |
| Splits the string by the first delim. More... | |
| string const | split (string const &a, char delim) |
| Same as split but does not return a piece. More... | |
| string const | rsplit (string const &a, string &piece, char delim) |
| Same as split but uses the last delim. More... | |
| string const | escape (string const &lab) |
| Escapes non ASCII chars. More... | |
| vector< string > const | getVectorFromString (string const &str, string const &delim) |
| gives a vector of stringparts which have the delimiter delim. More... | |
| string const | getStringFromVector (vector< string > const &vec, string const &delim) |
| string | bformat (string const &fmt, string const &arg1) |
| string | bformat (string const &fmt, string const &arg1, string const &arg2) |
| string | bformat (string const &fmt, string const &arg1, string const &arg2, string const &arg3) |
| string | bformat (string const &fmt, string const &arg1, string const &arg2, string const &arg3, string const &arg4) |
| string | bformat (string const &fmt, string const &arg1, string const &arg2, string const &arg3, string const &arg4, string const &arg5) |
| int | compare (char const *a, char const *b) |
| int | compare (char const *a, char const *b, unsigned int len) |
| string const | getcwd () |
| get the current working directory. More... | |
| int | chdir (string const &name) |
| change to a directory, 0 is returned on success. More... | |
| bool | rename (string const &from, string const &to) |
| rename a file, returns false if it fails. More... | |
| bool | copy (string const &from, string const &to) |
| copy a file, returns false it it fails. More... | |
| unsigned long | sum (string const &file) |
| generates a checksum of a file. More... | |
| int | kill (int pid, int sig) |
| FIXME: some point to this hmm ? More... | |
| void | abort () |
| FIXME: same here. More... | |
| int | mkdir (string const &pathname, unsigned long int mode) |
| create the given directory with the given mode. More... | |
| int | putenv (char const *str) |
| put a C string into the environment. More... | |
| int | unlink (string const &file) |
| unlink the given file. More... | |
| int | rmdir (string const &file) |
| remove the given directory. More... | |
| int | atoi (string const &nstr) |
| convert the given string to an integer. More... | |
| string const | tempName (string const &dir=string(), string const &mask=string()) |
| (securely) create a temporary file in the given dir with the given prefix. More... | |
| bool | float_equal (float var, float number, float error) |
| Returns true if var is approximately equal to number with allowed error of 'error'. More... | |
| string const | user_name () |
| return the current user's real name. More... | |
| string const | user_email () |
| return the current user's e-mail address. More... | |
|
|
Definition at line 222 of file filetools.h. Referenced by captureOutput, and Buffer::readFile. |
|
|
FIXME: same here.
Definition at line 17 of file abort.C. Referenced by error_handler, and LyX_XErrHandler.
00018 {
00019 ::abort();
00020 }
|
|
|
Returns true is path is absolute.
Definition at line 643 of file filetools.C. Referenced by lyx::graphics::Cache::add, LaTeX::deplog, get_grfx_params, RWInfo::ReadableDir, RWInfo::ReadableFile, FileDialog::Private::Select, InsetExternal::updateExternal, RWInfo::WriteableDir, and RWInfo::WriteableFile.
00644 {
00645 return os::is_absolute_path(path);
00646 }
|
|
||||||||||||
|
Add a filename to a path. Any path from filename is stripped first.
Definition at line 610 of file filetools.C. Referenced by FormPreferences::apply, ControlSendto::apply, ControlGraphics::Browse, ControlPrefs::browsebind, ControlPrefs::browsekbmap, ControlPrefs::browseUI, Converters::convert, InsetInclude::docbook, BufferList::emergencyWrite, Exporter::Export, RCS::find_file, Buffer::getLogName, LyX::init, InsetInclude::latex, InsetInclude::linuxdoc, LyXFunc::menuNew, LyX::queryUserLyXDir, Reconfigure, FileDialog::Private::Reread, Buffer::save, ControlDocument::saveAsDefault, FileDialog::Private::Select, unique_filename, and InsetInclude::validate.
00611 {
00612 // Get basename
00613 string const basename(OnlyFilename(fname));
00614
00615 string buf;
00616
00617 if (path != "." && path != "./" && !path.empty()) {
00618 buf = os::slashify_path(path);
00619 if (!suffixIs(path, '/'))
00620 buf += '/';
00621 }
00622
00623 return buf + basename;
00624 }
|
|
||||||||||||
|
Append sub-directory(ies) to path in an intelligent way.
Definition at line 880 of file filetools.C. Referenced by LyXFunc::doImport, RCS::find_file, LyX::init, BufferView::Pimpl::MenuInsertLyXFile, LyXFunc::open, and ControlDocument::saveAsDefault.
00881 {
00882 string buf;
00883 string const path2 = os::slashify_path(path_2);
00884
00885 if (!path.empty() && path != "." && path != "./") {
00886 buf = os::slashify_path(path);
00887 if (path[path.length() - 1] != '/')
00888 buf += '/';
00889 }
00890
00891 if (!path2.empty()) {
00892 string::size_type const p2start = path2.find_first_not_of('/');
00893 string::size_type const p2end = path2.find_last_not_of('/');
00894 string const tmp = path2.substr(p2start, p2end - p2start + 1);
00895 buf += tmp + '/';
00896 }
00897 return buf;
00898 }
|
|
|
same as lowercase(), but ignores locale.
Definition at line 277 of file lstrings.C. Referenced by Buffer::asciiParagraph, InsetBibtex::fillWithBibKeys, getNatbibLabel, LyXFont::lyxRead, LyXRC::read, LyXFont::setLyXFamily, LyXFont::setLyXMisc, LyXFont::setLyXSeries, LyXFont::setLyXShape, LyXFont::setLyXSize, and Debug::value.
00278 {
00279 string tmp(a);
00280 transform(tmp.begin(), tmp.end(), tmp.begin(),
00281 local_ascii_lowercase());
00282 return tmp;
00283 }
|
|
|
Definition at line 68 of file lstrings.C. Referenced by lyx::support::local_ascii_lowercase::operator().
00068 {
00069 if (c >= 'A' && c <= 'Z')
00070 return c - 'A' + 'a';
00071 return c;
00072 }
|
|
|
|
convert the given string to an integer.
Definition at line 22 of file atoi.C. Referenced by CharacterSet::loadFile, Buffer::makeDocBookFile, mathDispatch, MathSizeInset::MathSizeInset, Parser::parse1, FontInfo::query, and Chktex::scanLogFile.
00023 {
00024 return ::atoi(nstr.c_str());
00025 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 702 of file lstrings.C.
00704 {
00705 Assert(contains(fmt, "%1$s"));
00706 Assert(contains(fmt, "%2$s"));
00707 Assert(contains(fmt, "%3$s"));
00708 Assert(contains(fmt, "%4$s"));
00709 Assert(contains(fmt, "%5$s"));
00710 string str = subst(fmt, "%1$s", arg1);
00711 str = subst(str, "%2$s", arg2);
00712 str = subst(str, "%3$s", arg3);
00713 str = subst(str, "%4$s", arg4);
00714 str = subst(str, "%5$s", arg5);
00715 return subst(str, "%%", "%");
00716 }
|
|
||||||||||||||||||||||||
|
Definition at line 687 of file lstrings.C.
00689 {
00690 Assert(contains(fmt, "%1$s"));
00691 Assert(contains(fmt, "%2$s"));
00692 Assert(contains(fmt, "%3$s"));
00693 Assert(contains(fmt, "%4$s"));
00694 string str = subst(fmt, "%1$s", arg1);
00695 str = subst(str, "%2$s", arg2);
00696 str = subst(str, "%3$s", arg3);
00697 str = subst(str, "%4$s", arg4);
00698 return subst(str, "%%", "%");
00699 }
|
|
||||||||||||||||||||
|
Definition at line 674 of file lstrings.C.
|
|
||||||||||||||||
|
Definition at line 664 of file lstrings.C.
|
|
||||||||||||
|
Definition at line 656 of file lstrings.C.
|
|
||||||||||||
|
|
change to a directory, 0 is returned on success.
Definition at line 17 of file chdir.C.
00018 {
00019 #ifndef __EMX__
00020 return ::chdir(name.c_str());
00021 #else
00022 return ::_chdir2(name.c_str());
00023 #endif
00024 }
|
|
||||||||||||||||
|
Definition at line 48 of file lstrings.h.
00049 {
00050 #ifndef CXX_GLOBAL_CSTD
00051 return std::strncmp(a, b, len);
00052 #else
00053 return strncmp(a, b, len);
00054 #endif
00055 }
|
|
||||||||||||
|
Definition at line 37 of file lstrings.h.
00038 {
00039 #ifndef CXX_GLOBAL_CSTD
00040 return std::strcmp(a, b);
00041 #else
00042 return strcmp(a, b);
00043 #endif
00044 }
|
|
||||||||||||
|
Definition at line 76 of file lstrings.C. Referenced by Buffer::asciiParagraph, Menu::checkShortcuts, LColor::getFromGUIName, LColor::getFromLyXName, LyXLex::getLongString, compare_tags::operator(), biblio::compareNoCase::operator(), operator<, ToolbarBackend::read, MenuBackend::read, readInset, readParToken, ToolbarBackend::readToolbars, and LyXLex::Pimpl::search_kw.
00077 {
00078 string::const_iterator p = s.begin();
00079 string::const_iterator p2 = s2.begin();
00080
00081 while (p != s.end() && p2 != s2.end()) {
00082 int const lc1 = ascii_tolower(*p);
00083 int const lc2 = ascii_tolower(*p2);
00084 if (lc1 != lc2)
00085 return (lc1 < lc2) ? -1 : 1;
00086 ++p;
00087 ++p2;
00088 }
00089
00090 if (s.size() == s2.size())
00091 return 0;
00092 if (s.size() < s2.size())
00093 return -1;
00094 return 1;
00095 }
|
|
||||||||||||||||
|
Definition at line 98 of file lstrings.C.
00099 {
00100 string::const_iterator p = s.begin();
00101 string::const_iterator p2 = s2.begin();
00102 unsigned int i = 0;
00103 while (i < len && p != s.end() && p2 != s2.end()) {
00104 int const lc1 = tolower(*p);
00105 int const lc2 = tolower(*p2);
00106 if (lc1 != lc2)
00107 return (lc1 < lc2) ? -1 : 1;
00108 ++i;
00109 ++p;
00110 ++p2;
00111 }
00112
00113 if (s.size() >= len && s2.size() >= len)
00114 return 0;
00115 if (s.size() < s2.size())
00116 return -1;
00117 return 1;
00118 }
|
|
||||||||||||
|
Definition at line 45 of file lstrings.C.
00046 {
00047 string::const_iterator p = s.begin();
00048 string::const_iterator p2 = s2.begin();
00049
00050 while (p != s.end() && p2 != s2.end()) {
00051 int const lc1 = tolower(*p);
00052 int const lc2 = tolower(*p2);
00053 if (lc1 != lc2)
00054 return (lc1 < lc2) ? -1 : 1;
00055 ++p;
00056 ++p2;
00057 }
00058
00059 if (s.size() == s2.size())
00060 return 0;
00061 if (s.size() < s2.size())
00062 return -1;
00063 return 1;
00064 }
|
|
||||||||||||
|
Definition at line 336 of file lstrings.C.
00337 {
00338 if (a.empty())
00339 return false;
00340 return a.find(b) != string::npos;
00341 }
|
|
||||||||||||
|
Definition at line 328 of file lstrings.C. Referenced by lyx::support::contains_functor::operator().
00329 {
00330 if (a.empty())
00331 return false;
00332 return a.find(b) != string::npos;
00333 }
|
|
||||||||||||
|
Definition at line 344 of file lstrings.C.
00345 {
00346 return s.find_first_not_of(cset) == string::npos;
00347 }
|
|
||||||||||||
|
copy a file, returns false it it fails.
Definition at line 22 of file copy.C. Referenced by getContentsOfAsciiFile, Converters::move, InsetGraphics::prepareFile, and LastFiles::writeFile.
00023 {
00024 ifstream ifs(from.c_str());
00025 if (!ifs)
00026 return false;
00027 ofstream ofs(to.c_str(),
00028 ios::binary | ios::out | ios::trunc);
00029 if (!ofs)
00030 return false;
00031 ofs << ifs.rdbuf();
00032 if (ofs.good())
00033 return true;
00034 return false;
00035 }
|
|
||||||||||||
|
Copy The file name is manipulated so that eg some/path/to/file becomes some_path_to_file.
Definition at line 1338 of file filetools.C. Referenced by InsetGraphics::prepareFile, and InsetExternal::updateExternal.
01339 {
01340 Assert(AbsolutePath(path));
01341
01342 // First, make the file path relative to path.
01343 string file_out = MakeRelPath(path, NormalizePath(file_in));
01344 file_out = os::slashify_path(file_out);
01345
01346 // Now generate a unique filename.
01347 // Remove the extension.
01348 file_out = ChangeExtension(file_out, string());
01349 // Replace '/' in the file name with '_'
01350 file_out = subst(file_out, "/", "_");
01351 // Replace '.' in the file name with '_'
01352 file_out = subst(file_out, ".", "_");
01353 // Append a unique ID
01354 static int id;
01355 file_out += '_' + tostr(id++);
01356 // Add the extension back on
01357 file_out = ChangeExtension(file_out, GetExtension(file_in));
01358 // Put this file in the buffer's temp dir
01359 file_out = MakeAbsPath(file_out, path);
01360
01361 // If the original is newer than the copy, then copy the original
01362 // to the new directory.
01363 FileInfo fi(file_in);
01364 FileInfo fi2(file_out);
01365
01366 bool success = true;
01367 if (fi.exist()) {
01368 if (!fi2.exist() ||
01369 difftime(fi.getModificationTime(),
01370 fi2.getModificationTime()) >= 0)
01371 success = copy(file_in, file_out);
01372 }
01373
01374 return success ? file_out : string();
01375 }
|
|
|
Definition at line 481 of file filetools.C. Referenced by Buffer::Buffer.
00482 {
00483 static int count;
00484 static string const tmpdir(pathfor.empty() ? os::getTmpDir() : pathfor);
00485 // We are in our own directory. Why bother to mangle name?
00486 // In fact I wrote this code to circumvent a problematic behaviour (bug?)
00487 // of EMX mkstemp().
00488 string const tmpfl = tmpdir + "/lyx_tmpbuf" + tostr(count++);
00489 if (mkdir(tmpfl, 0777)) {
00490 return string();
00491 }
00492 return tmpfl;
00493 }
|
|
||||||||||||
|
Creates directory. Returns true on success.
Definition at line 515 of file filetools.C. Referenced by LyX::queryUserLyXDir.
|