Eliminate some object file bloat

This commit is contained in:
Thomas Goyne 2014-12-30 17:31:10 -08:00
parent affb47776b
commit b6edf58651
6 changed files with 31 additions and 12 deletions

View file

@ -24,9 +24,9 @@ enum Type {
void Check(fs::path const& file, acs::Type); void Check(fs::path const& file, acs::Type);
inline void CheckFileRead(fs::path const& file) { Check(file, acs::FileRead); } static inline void CheckFileRead(fs::path const& file) { Check(file, acs::FileRead); }
inline void CheckFileWrite(fs::path const& file) { Check(file, acs::FileWrite); } static inline void CheckFileWrite(fs::path const& file) { Check(file, acs::FileWrite); }
inline void CheckDirRead(fs::path const& dir) { Check(dir, acs::DirRead); } static inline void CheckDirRead(fs::path const& dir) { Check(dir, acs::DirRead); }
inline void CheckDirWrite(fs::path const& dir) { Check(dir, acs::DirWrite); } static inline void CheckDirWrite(fs::path const& dir) { Check(dir, acs::DirWrite); }
} } } }

View file

@ -166,8 +166,8 @@ namespace agi {
template<typename T> void GetAll(T& cont); template<typename T> void GetAll(T& cont);
}; };
inline DirectoryIterator& begin(DirectoryIterator &it) { return it; } static inline DirectoryIterator& begin(DirectoryIterator &it) { return it; }
inline DirectoryIterator end(DirectoryIterator &) { return DirectoryIterator(); } static inline DirectoryIterator end(DirectoryIterator &) { return DirectoryIterator(); }
template<typename T> template<typename T>
inline void DirectoryIterator::GetAll(T& cont) { inline void DirectoryIterator::GetAll(T& cont) {

View file

@ -25,7 +25,7 @@ namespace agi {
return boost::make_split_iterator(str, boost::token_finder([=](Char c) { return c == delim; })); return boost::make_split_iterator(str, boost::token_finder([=](Char c) { return c == delim; }));
} }
inline std::string str(StringRange const& r) { static inline std::string str(StringRange const& r) {
return std::string(r.begin(), r.end()); return std::string(r.begin(), r.end());
} }
} }

View file

@ -21,7 +21,10 @@ struct tm;
namespace agi { namespace agi {
namespace util { namespace util {
/// Clamp `b` to the range [`a`,`c`] /// Clamp `b` to the range [`a`,`c`]
template<typename T> inline T mid(T a, T b, T c) { return std::max(a, std::min(b, c)); } template<typename T>
static inline T mid(T a, T b, T c) {
return std::max(a, std::min(b, c));
}
bool try_parse(std::string const& str, double *out); bool try_parse(std::string const& str, double *out);
bool try_parse(std::string const& str, int *out); bool try_parse(std::string const& str, int *out);

View file

@ -19,3 +19,19 @@ wxArrayString to_wx(std::vector<std::string> const& vec) {
transform(vec.begin(), vec.end(), std::back_inserter(ret), (wxString (*)(std::string const&))to_wx); transform(vec.begin(), vec.end(), std::back_inserter(ret), (wxString (*)(std::string const&))to_wx);
return ret; return ret;
} }
wxColour to_wx(agi::Color color) {
return wxColour(color.r, color.g, color.b, 255 - color.a);
}
wxString to_wx(std::string const& str) {
return wxString(str.c_str(), wxConvUTF8);
}
agi::Color from_wx(wxColour color) {
return agi::Color(color.Red(), color.Green(), color.Blue(), 255 - color.Alpha());
}
std::string from_wx(wxString const& str) {
return std::string(str.utf8_str());
}

View file

@ -9,11 +9,11 @@
#include <libaegisub/color.h> #include <libaegisub/color.h>
inline wxColour to_wx(agi::Color color) { return wxColour(color.r, color.g, color.b, 255 - color.a); } wxColour to_wx(agi::Color color);
inline wxString to_wx(std::string const& str) { return wxString(str.c_str(), wxConvUTF8); } wxString to_wx(std::string const& str);
wxArrayString to_wx(std::vector<std::string> const& vec); wxArrayString to_wx(std::vector<std::string> const& vec);
inline agi::Color from_wx(wxColour color) { return agi::Color(color.Red(), color.Green(), color.Blue(), 255 - color.Alpha()); } agi::Color from_wx(wxColour color);
inline std::string from_wx(wxString const& str) { return std::string(str.utf8_str()); } std::string from_wx(wxString const& str);
wxArrayString lagi_MRU_wxAS(const char *list); wxArrayString lagi_MRU_wxAS(const char *list);