| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | #include <osg/Notify> |
|---|
| 22 | #include <osg/ArgumentParser> |
|---|
| 23 | #include <osgDB/FileNameUtils> |
|---|
| 24 | #include <list> |
|---|
| 25 | |
|---|
| 26 | void runFileNameUtilsTest(osg::ArgumentParser&) |
|---|
| 27 | { |
|---|
| 28 | typedef std::list<std::string> Strings; |
|---|
| 29 | Strings strings; |
|---|
| 30 | strings.push_back(std::string("")); |
|---|
| 31 | strings.push_back(std::string("myfile")); |
|---|
| 32 | strings.push_back(std::string(".osgt")); |
|---|
| 33 | strings.push_back(std::string("myfile.osgt")); |
|---|
| 34 | strings.push_back(std::string("/myfile.osgt")); |
|---|
| 35 | strings.push_back(std::string("home/robert/myfile.osgt")); |
|---|
| 36 | strings.push_back(std::string("/home/robert/myfile.osgt")); |
|---|
| 37 | strings.push_back(std::string("\\myfile.osgt")); |
|---|
| 38 | strings.push_back(std::string("home\\robert\\myfile.osgt")); |
|---|
| 39 | strings.push_back(std::string("\\home\\robert\\myfile.osgt")); |
|---|
| 40 | strings.push_back(std::string("\\home/robert\\myfile.osgt")); |
|---|
| 41 | strings.push_back(std::string("\\home\\robert/myfile.osgt")); |
|---|
| 42 | strings.push_back(std::string("home/robert/")); |
|---|
| 43 | strings.push_back(std::string("\\home\\robert\\")); |
|---|
| 44 | strings.push_back(std::string("home/robert/myfile")); |
|---|
| 45 | strings.push_back(std::string("\\home\\robert\\myfile")); |
|---|
| 46 | strings.push_back(std::string("home/robert/.osgt")); |
|---|
| 47 | strings.push_back(std::string("\\home\\robert\\.osgt")); |
|---|
| 48 | strings.push_back(std::string("home/robert/myfile.ext.osgt")); |
|---|
| 49 | strings.push_back(std::string("home\\robert\\myfile.ext.osgt")); |
|---|
| 50 | |
|---|
| 51 | for(Strings::iterator itr = strings.begin(); |
|---|
| 52 | itr != strings.end(); |
|---|
| 53 | ++itr) |
|---|
| 54 | { |
|---|
| 55 | std::string& str = *itr; |
|---|
| 56 | OSG_NOTICE<<"string="<<str; |
|---|
| 57 | OSG_NOTICE<<"\n\tosgDB::getFilePath(str)="<<osgDB::getFilePath(str); |
|---|
| 58 | OSG_NOTICE<<"\n\tosgDB::getSimpleFileName(str)="<<osgDB::getSimpleFileName(str); |
|---|
| 59 | OSG_NOTICE<<"\n\tosgDB::getStrippedName(str)="<<osgDB::getStrippedName(str); |
|---|
| 60 | OSG_NOTICE<<"\n\tosgDB::getFileExtension(str)="<<osgDB::getFileExtension(str); |
|---|
| 61 | OSG_NOTICE<<"\n\tosgDB::getFileExtensionIncludingDot(str)="<<osgDB::getFileExtensionIncludingDot(str); |
|---|
| 62 | OSG_NOTICE<<"\n\tosgDB::getNameLessExtension(str)="<<osgDB::getNameLessExtension(str); |
|---|
| 63 | OSG_NOTICE<<"\n\tosgDB::getNameLessAllExtensions(str)="<<osgDB::getNameLessAllExtensions(str); |
|---|
| 64 | OSG_NOTICE<<std::endl<<std::endl; |
|---|
| 65 | } |
|---|
| 66 | } |
|---|