MiscStuff.h
Go to the documentation of this file.00001
00002
00003
00004
00005 #pragma once
00006
00007 #include <string>
00008 #include <vector>
00009 #include <stdlib.h>
00010 #include "File.h"
00011 #include "Types.h"
00012
00014 namespace MISC
00015 {
00016
00017
00019 std::string ReadFile(const MPMA::Filename &fname);
00021 bool LoadStringList(std::vector<std::string> &outList, const MPMA::Filename &file);
00023 std::string MakeLower(const std::string &str);
00025 std::string StripFirstLine(const std::string &str);
00027 std::string StripPadding(const std::string &str);
00029 uint CountBits(uint data);
00031 int GetHighestBit(uint data);
00033 void ExplodeString(const std::string &inData, std::vector<std::string> &outData, const std::string &inDeliminators=" \t\n");
00035 uint ParseHexString(const std::string &s);
00037 bool StartsWith(const std::string &haystack, const std::string &needle);
00039 bool EndsWith(const std::string &haystack, const std::string &needle);
00041 bool Contains(const std::string &haystack, const std::string &needle);
00043 int IndexOf(const std::string &haystack, const std::string &needle, int startIndex=0);
00044 }
00045
00046
00047
00048
00049 inline double rndd() { return ((double)rand()/(double)RAND_MAX); }
00050 inline float rndf() { return ((float)rand()/(float)RAND_MAX); }