Alientech 0.01
An extendable game engine
C:/Alientech/AlienCargoHold/ACHCommonUtils.cpp
Go to the documentation of this file.
00001 #include "ACHCommonUtils.h"
00002 using namespace alien::utils;
00003 
00004 string alien::utils::ACHreadName(ifstream* file)
00005 {
00006         unsigned char nameLength;
00007         file->read((char*)&nameLength,1);
00008         char* nameCStr = new char[nameLength];
00009         file->read(nameCStr,nameLength);
00010         return string(nameCStr);
00011 }
00012 
00013 int alien::utils::ACHreadInt(ifstream* file)
00014 {
00015         int number;
00016         file->read((char*)&number,4);
00017         return number;
00018 }
00019 
00020 unsigned alien::utils::ACHreadUnsigned(ifstream* file)
00021 {
00022         unsigned number;
00023         file->read((char*)&number,4);
00024         return number;
00025 }
00026 
00027 bool alien::utils::ACHisAFile(string path)
00028 {
00029         return (path.find("\\") == string::npos);
00030 }
00031 
00032 string alien::utils::ACHgrabFirstSubdir(string path)
00033 {
00034         size_t pos = path.find("\\");
00035         if (pos == string::npos)
00036                 return path;
00037         else
00038                 return path.substr(0,pos);
00039 }
00040 
00041 string alien::utils::ACHstripFirstSubdir(string path)
00042 {
00043         return path.substr(path.find("\\")+1);
00044 }