mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-13 03:40:34 +00:00
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:
parent
a3a55117e1
commit
ec0ed4013c
@ -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>
|
1999-11-02 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
* src/support/filetools.C (SpaceLess): new version of the
|
* src/support/filetools.C (SpaceLess): new version of the
|
||||||
|
@ -74,16 +74,18 @@ string SpaceLess(string const & file)
|
|||||||
|
|
||||||
for (string::size_type i = 0; i < name.length(); ++i) {
|
for (string::size_type i = 0; i < name.length(); ++i) {
|
||||||
name[i] &= 0x7f; // set 8th bit to 0
|
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.
|
// ok so we scan through the string twice, but who cares.
|
||||||
string change("/");
|
string keep("abcdefghijklmnopqrstuvwxyz"
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
"@!\"'()*+,-./0123456789:;<=>?[]`|");
|
||||||
|
|
||||||
string::size_type pos = 0;
|
string::size_type pos = 0;
|
||||||
while ((pos = name.find_first_of(change, pos)) != string::npos) {
|
while ((pos = name.find_first_not_of(change, pos)) != string::npos) {
|
||||||
name[pos] = '-';
|
name[pos] = '_';
|
||||||
}
|
}
|
||||||
string temp = AddName(path, name);
|
return AddName(path, name);
|
||||||
return temp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user