new SpaceLess function

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@279 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 1999-11-03 12:24:23 +00:00
parent a3a55117e1
commit ec0ed4013c
2 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,8 @@
1999-11-03 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/filetools.C (SpaceLess): yet another version of the
algorithm...now per Jean-Marc's suggestions.
1999-11-02 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/filetools.C (SpaceLess): new version of the

View File

@ -74,16 +74,18 @@ string SpaceLess(string const & file)
for (string::size_type i = 0; i < name.length(); ++i) {
name[i] &= 0x7f; // set 8th bit to 0
if (!isgraph(name[i])) name[i] = '_'; // get rid of cntrl chars
};
// ok so we scan through the string twice, but who cares.
string change("/");
string keep("abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"@!\"'()*+,-./0123456789:;<=>?[]`|");
string::size_type pos = 0;
while ((pos = name.find_first_of(change, pos)) != string::npos) {
name[pos] = '-';
while ((pos = name.find_first_not_of(change, pos)) != string::npos) {
name[pos] = '_';
}
string temp = AddName(path, name);
return temp;
return AddName(path, name);
}