aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2011-11-08 10:26:04 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-05 17:17:49 +0100
commitc1c799117e7076046182e12d71d06e2c9444e9be (patch)
tree7940de26d0c786134fa103703320bd3efcbba00c /src
parent31ba94d4efa6e3f64ffacf1711438e88d8b3035d (diff)
downloadusdx-c1c799117e7076046182e12d71d06e2c9444e9be.tar.gz
usdx-c1c799117e7076046182e12d71d06e2c9444e9be.tar.xz
usdx-c1c799117e7076046182e12d71d06e2c9444e9be.zip
changed all wstring/wchar_t to string/char
Diffstat (limited to 'src')
-rw-r--r--src/base/image.cpp2
-rw-r--r--src/base/lyric_word.cpp10
-rw-r--r--src/base/lyric_word.hpp4
-rw-r--r--src/base/song.cpp108
-rw-r--r--src/base/song.hpp60
-rw-r--r--src/base/songloading/songloader.cpp12
-rw-r--r--src/base/songloading/songloader.hpp2
-rw-r--r--src/base/songloading/songloading_strategy_base_factory.cpp4
-rw-r--r--src/base/songloading/songloading_strategy_base_factory.hpp6
-rw-r--r--src/base/songloading/songloading_strategy_txt.cpp93
-rw-r--r--src/base/songloading/songloading_strategy_txt.hpp16
-rw-r--r--src/base/songloading/songloading_strategy_xml.hpp2
-rw-r--r--src/base/stats.hpp30
-rw-r--r--src/base/texture.cpp6
-rw-r--r--src/frames/loading_frame.cpp5
-rw-r--r--src/frames/loading_frame.hpp4
-rw-r--r--src/menu/application.cpp4
-rw-r--r--src/menu/event_manager.cpp2
-rw-r--r--src/menu/software_mouse_pointer.cpp4
-rw-r--r--src/utils/locale_independent_float.cpp18
-rw-r--r--src/utils/locale_independent_float.hpp8
-rw-r--r--src/utils/text_file.cpp (renamed from src/utils/unicode_file.cpp)12
-rw-r--r--src/utils/text_file.hpp (renamed from src/utils/unicode_file.hpp)16
23 files changed, 217 insertions, 211 deletions
diff --git a/src/base/image.cpp b/src/base/image.cpp
index d1d944eb..7b06cc3e 100644
--- a/src/base/image.cpp
+++ b/src/base/image.cpp
@@ -68,7 +68,7 @@ namespace usdx
surface = IMG_Load_RW(source, 1);
if (surface == NULL) {
- LOG4CXX_ERROR(log, L"Error loading image: " << filename);
+ LOG4CXX_ERROR(log, "Error loading image: " << filename);
throw ImageLoadException(IMG_GetError());
}
}
diff --git a/src/base/lyric_word.cpp b/src/base/lyric_word.cpp
index 979d02a9..c6c5d7d9 100644
--- a/src/base/lyric_word.cpp
+++ b/src/base/lyric_word.cpp
@@ -28,20 +28,20 @@
namespace usdx
{
- LyricWord::LyricWord(const wchar_t type,
+ LyricWord::LyricWord(const char type,
const int beat,
const int length,
const int height,
- const std::wstring& lyric) :
+ const std::string& lyric) :
beat(beat), length(length), height(height), text(lyric)
{
- if (type == L':') {
+ if (type == ':') {
this->type = nt_normal;
}
- else if (type == L'*') {
+ else if (type == '*') {
this->type = nt_golden;
}
- else if (type == L'F') {
+ else if (type == 'F') {
this->type = nt_freestyle;
}
}
diff --git a/src/base/lyric_word.hpp b/src/base/lyric_word.hpp
index 54f2ea3f..4b19b13c 100644
--- a/src/base/lyric_word.hpp
+++ b/src/base/lyric_word.hpp
@@ -44,10 +44,10 @@ namespace usdx
int beat;
int length;
int height;
- std::wstring text;
+ std::string text;
public:
- LyricWord(const wchar_t type, const int beat, const int length, const int height, const std::wstring& lyric);
+ LyricWord(const char type, const int beat, const int length, const int height, const std::string& lyric);
virtual ~LyricWord(void);
};
};
diff --git a/src/base/song.cpp b/src/base/song.cpp
index 9b0cbf12..209f13de 100644
--- a/src/base/song.cpp
+++ b/src/base/song.cpp
@@ -39,38 +39,38 @@ namespace usdx
}
Song::Song(const boost::filesystem::wpath& filename,
- const std::map<std::wstring, std::wstring>& header) :
+ const std::map<std::string, std::string>& header) :
filename(filename), custom_header_tags(header)
{
- std::map<std::wstring, std::wstring>::iterator it;
+ std::map<std::string, std::string>::iterator it;
- title = get_header_tag(L"TITLE", true);
- artist = get_header_tag(L"ARTIST", true);
- mp3 = get_header_tag(L"MP3", true);
+ title = get_header_tag("TITLE", true);
+ artist = get_header_tag("ARTIST", true);
+ mp3 = get_header_tag("MP3", true);
- bpm.push_back(new BPM(get_header_tag_float(L"BPM", true)));
+ bpm.push_back(new BPM(get_header_tag_float("BPM", true)));
- gap = get_header_tag_float(L"GAP");
- cover_file = get_header_tag(L"COVER");
- background = get_header_tag(L"BACKGROUND");
+ gap = get_header_tag_float("GAP");
+ cover_file = get_header_tag("COVER");
+ background = get_header_tag("BACKGROUND");
- video = get_header_tag(L"VIDEO");
- video_gap = get_header_tag_float(L"VIDEOGAP");
+ video = get_header_tag("VIDEO");
+ video_gap = get_header_tag_float("VIDEOGAP");
- genre = get_header_tag(L"GENRE");
- edition = get_header_tag(L"EDITION");
- creator = get_header_tag(L"CREATOR");
- language = get_header_tag(L"LANGUAGE");
+ genre = get_header_tag("GENRE");
+ edition = get_header_tag("EDITION");
+ creator = get_header_tag("CREATOR");
+ language = get_header_tag("LANGUAGE");
- year = get_header_tag_int(L"YEAR");
+ year = get_header_tag_int("YEAR");
- start = get_header_tag_float(L"START");
- stop = get_header_tag_int(L"END");
+ start = get_header_tag_float("START");
+ stop = get_header_tag_int("END");
- resolution = get_header_tag_int(L"RESOLUTION");
- notes_gap = get_header_tag_int(L"NOTESGAP");
+ resolution = get_header_tag_int("RESOLUTION");
+ notes_gap = get_header_tag_int("NOTESGAP");
- relative = get_header_tag_bool(L"RELATIVE");
+ relative = get_header_tag_bool("RELATIVE");
// TODO
// EncFile := DecodeFilename(Value);
@@ -98,27 +98,27 @@ namespace usdx
lyrics.clear();
}
- std::wstring Song::get_header_tag(const std::wstring& tag, const bool required)
+ std::string Song::get_header_tag(const std::string& tag, const bool required)
{
- std::map<std::wstring, std::wstring>::iterator it;
- std::wstring result = L"";
+ std::map<std::string, std::string>::iterator it;
+ std::string result = "";
if ((it = custom_header_tags.find(tag)) != custom_header_tags.end()) {
result = it->second;
custom_header_tags.erase(it);
}
else if (required) {
- LOG4CXX_ERROR(log, L"Incomplete Song! Missing '" << tag << L"' Tag in: '" <<
- get_filename() << L"'");
+ LOG4CXX_ERROR(log, "Incomplete Song! Missing '" << tag << "' Tag in: '" <<
+ get_filename() << "'");
throw MissingTagException(tag, "Incomplete Song! Missing Tag.");
}
return result;
}
- float Song::get_header_tag_float(const std::wstring& tag, const bool required)
+ float Song::get_header_tag_float(const std::string& tag, const bool required)
{
- std::map<std::wstring, std::wstring>::iterator it;
+ std::map<std::string, std::string>::iterator it;
float result;
if ((it = custom_header_tags.find(tag)) != custom_header_tags.end()) {
@@ -126,49 +126,49 @@ namespace usdx
custom_header_tags.erase(it);
}
else if (required) {
- LOG4CXX_ERROR(log, L"Incomplete Song! Missing '" << tag << L"' Tag in: '" <<
- get_filename() << L"'");
+ LOG4CXX_ERROR(log, "Incomplete Song! Missing '" << tag << "' Tag in: '" <<
+ get_filename() << "'");
throw MissingTagException(tag, "Incomplete Song! Missing Tag.");
}
return result;
}
- int Song::get_header_tag_int(const std::wstring& tag, const bool required)
+ int Song::get_header_tag_int(const std::string& tag, const bool required)
{
- std::map<std::wstring, std::wstring>::iterator it;
+ std::map<std::string, std::string>::iterator it;
int result;
if ((it = custom_header_tags.find(tag)) != custom_header_tags.end()) {
- std::wistringstream stream(it->second);
+ std::istringstream stream(it->second);
custom_header_tags.erase(it);
stream >> result;
}
else if (required) {
- LOG4CXX_ERROR(log, L"Incomplete Song! Missing '" << tag << L"' Tag in: '" <<
- get_filename() << L"'");
+ LOG4CXX_ERROR(log, "Incomplete Song! Missing '" << tag << "' Tag in: '" <<
+ get_filename() << "'");
throw MissingTagException(tag, "Incomplete Song! Missing Tag.");
}
return result;
}
- bool Song::get_header_tag_bool(const std::wstring& tag, const bool required)
+ bool Song::get_header_tag_bool(const std::string& tag, const bool required)
{
- std::map<std::wstring, std::wstring>::iterator it;
+ std::map<std::string, std::string>::iterator it;
bool result;
if ((it = custom_header_tags.find(tag)) != custom_header_tags.end()) {
// accept all like (YES, JA, TRUE, 1)
- result = (it->second[0] == L'j' || it->second[0] == L'J' ||
- it->second[0] == L'y' || it->second[0] == L'Y' ||
- it->second[0] == L't' || it->second[0] == L'T' ||
- it->second[0] == L'1');
+ result = (it->second[0] == 'j' || it->second[0] == 'J' ||
+ it->second[0] == 'y' || it->second[0] == 'Y' ||
+ it->second[0] == 't' || it->second[0] == 'T' ||
+ it->second[0] == '1');
custom_header_tags.erase(it);
}
else if (required) {
- LOG4CXX_ERROR(log, L"Incomplete Song! Missing '" << tag << L"' Tag in: '" <<
- get_filename() << L"'");
+ LOG4CXX_ERROR(log, "Incomplete Song! Missing '" << tag << "' Tag in: '" <<
+ get_filename() << "'");
throw MissingTagException(tag, "Incomplete Song! Missing Tag.");
}
@@ -191,17 +191,17 @@ namespace usdx
return line;
}
- const std::wstring& Song::get_title(void) const
+ const std::string& Song::get_title(void) const
{
return title;
}
- const std::wstring& Song::get_artist(void) const
+ const std::string& Song::get_artist(void) const
{
return artist;
}
- const std::wstring& Song::get_mp3(void) const
+ const std::string& Song::get_mp3(void) const
{
return mp3;
}
@@ -226,17 +226,17 @@ namespace usdx
return gap;
}
- const std::wstring& Song::get_cover_file(void) const
+ const std::string& Song::get_cover_file(void) const
{
return cover_file;
}
- const std::wstring& Song::get_background(void) const
+ const std::string& Song::get_background(void) const
{
return background;
}
- const std::wstring& Song::get_video(void) const
+ const std::string& Song::get_video(void) const
{
return video;
}
@@ -246,22 +246,22 @@ namespace usdx
return video_gap;
}
- const std::wstring& Song::get_genre(void) const
+ const std::string& Song::get_genre(void) const
{
return genre;
}
- const std::wstring& Song::get_edition(void) const
+ const std::string& Song::get_edition(void) const
{
return edition;
}
- const std::wstring& Song::get_creator(void) const
+ const std::string& Song::get_creator(void) const
{
return creator;
}
- const std::wstring& Song::get_language(void) const
+ const std::string& Song::get_language(void) const
{
return language;
}
@@ -321,7 +321,7 @@ namespace usdx
create_new_lyric_line(line_in + get_relative_beat());
}
- void Song::new_note(const wchar_t type, const int beat, const int length, const int height, const std::wstring& lyric)
+ void Song::new_note(const char type, const int beat, const int length, const int height, const std::string& lyric)
{
get_last_lyric_line()->add_word(new LyricWord(type, beat + get_relative_beat(), length, height, lyric));
}
diff --git a/src/base/song.hpp b/src/base/song.hpp
index d0c06c9a..c5b160af 100644
--- a/src/base/song.hpp
+++ b/src/base/song.hpp
@@ -45,16 +45,16 @@ namespace usdx
/**
* TODO: Maybe refactor this to separate sub-classes.
*/
- const std::wstring tag;
+ const std::string tag;
public:
- MissingTagException(const std::wstring tag,
+ MissingTagException(const std::string tag,
const std::string message) :
BaseException(message), tag(tag) {};
~MissingTagException () throw () {};
- virtual const std::wstring& get_tag() const { return tag; };
+ virtual const std::string& get_tag() const { return tag; };
};
class Song
@@ -64,25 +64,25 @@ namespace usdx
boost::filesystem::wpath filename;
- std::wstring title;
- std::wstring artist;
+ std::string title;
+ std::string artist;
// filenames
- std::wstring mp3;
+ std::string mp3;
- std::wstring background;
+ std::string background;
- std::wstring video;
+ std::string video;
float video_gap;
- std::wstring cover_file;
+ std::string cover_file;
Texture* cover;
- std::wstring genre;
- std::wstring edition;
- std::wstring language;
+ std::string genre;
+ std::string edition;
+ std::string language;
int year;
- std::wstring creator;
+ std::string creator;
int notes_gap;
float gap; ///< in miliseconds
@@ -96,12 +96,12 @@ namespace usdx
std::list<LyricLine*> lyrics;
- std::map<std::wstring, std::wstring> custom_header_tags;
+ std::map<std::string, std::string> custom_header_tags;
- std::wstring get_header_tag(const std::wstring& tag, const bool required = false);
- float get_header_tag_float(const std::wstring& tag, const bool required = false);
- int get_header_tag_int(const std::wstring& tag, const bool required = false);
- bool get_header_tag_bool(const std::wstring& tag, const bool required = false);
+ std::string get_header_tag(const std::string& tag, const bool required = false);
+ float get_header_tag_float(const std::string& tag, const bool required = false);
+ int get_header_tag_int(const std::string& tag, const bool required = false);
+ bool get_header_tag_bool(const std::string& tag, const bool required = false);
LyricLine* get_last_lyric_line(void);
LyricLine* create_new_lyric_line(int start);
@@ -117,25 +117,25 @@ namespace usdx
// TODO: Encoding: TEncoding;
public:
Song(const boost::filesystem::wpath& filename,
- const std::map<std::wstring, std::wstring>& header);
+ const std::map<std::string, std::string>& header);
virtual ~Song(void);
const boost::filesystem::wpath& get_filename(void) const;
- const std::wstring& get_title(void) const;
- const std::wstring& get_artist(void) const;
- const std::wstring& get_mp3(void) const;
+ const std::string& get_title(void) const;
+ const std::string& get_artist(void) const;
+ const std::string& get_mp3(void) const;
const float get_bpm(int beat) const;
const float get_gap(void) const;
- const std::wstring& get_cover_file(void) const;
- const std::wstring& get_background(void) const;
- const std::wstring& get_video(void) const;
+ const std::string& get_cover_file(void) const;
+ const std::string& get_background(void) const;
+ const std::string& get_video(void) const;
const float get_video_gap(void) const;
- const std::wstring& get_genre(void) const;
- const std::wstring& get_edition(void) const;
- const std::wstring& get_creator(void) const;
- const std::wstring& get_language(void) const;
+ const std::string& get_genre(void) const;
+ const std::string& get_edition(void) const;
+ const std::string& get_creator(void) const;
+ const std::string& get_language(void) const;
const int get_year(void) const;
const float get_start(void) const;
const int get_stop(void) const;
@@ -148,7 +148,7 @@ namespace usdx
void new_bpm(const int beat, const float new_bpm);
void new_line(const int line_out, const int line_in);
- void new_note(const wchar_t type, const int beat, const int length, const int height, const std::wstring& lyric);
+ void new_note(const char type, const int beat, const int length, const int height, const std::string& lyric);
};
};
diff --git a/src/base/songloading/songloader.cpp b/src/base/songloading/songloader.cpp
index 0524d18c..5562bdc7 100644
--- a/src/base/songloading/songloader.cpp
+++ b/src/base/songloading/songloader.cpp
@@ -58,10 +58,10 @@ namespace usdx
Song *Songloader::load_header(const boost::filesystem::wpath& filename)
{
- std::wstring ext = extension(filename);
- std::map<std::wstring, SongloadingStrategyBaseFactory*>::iterator it = strategies.find(ext);
+ std::string ext = extension(filename);
+ std::map<std::string, SongloadingStrategyBaseFactory*>::iterator it = strategies.find(ext);
if (it == strategies.end()) {
- LOG4CXX_WARN(log, L"No SongloadingStrategy found for file extension: '" << ext << L"'");
+ LOG4CXX_WARN(log, "No SongloadingStrategy found for file extension: '" << ext << "'");
throw NoStrategyException("Unknown file format.");
}
@@ -70,10 +70,10 @@ namespace usdx
Song* Songloader::load_song(Song* song)
{
- std::wstring ext = extension(song->get_filename());
- std::map<std::wstring, SongloadingStrategyBaseFactory*>::iterator it = strategies.find(ext);
+ std::string ext = extension(song->get_filename());
+ std::map<std::string, SongloadingStrategyBaseFactory*>::iterator it = strategies.find(ext);
if (it == strategies.end()) {
- LOG4CXX_WARN(log, L"No SongloadingStrategy found for file extension: '" << ext << L"'");
+ LOG4CXX_WARN(log, "No SongloadingStrategy found for file extension: '" << ext << "'");
throw NoStrategyException("Unknown file format.");
}
diff --git a/src/base/songloading/songloader.hpp b/src/base/songloading/songloader.hpp
index ac18f41d..4b7150ab 100644
--- a/src/base/songloading/songloader.hpp
+++ b/src/base/songloading/songloader.hpp
@@ -50,7 +50,7 @@ namespace usdx
Songloader(void);
- std::map<std::wstring, SongloadingStrategyBaseFactory*> strategies;
+ std::map<std::string, SongloadingStrategyBaseFactory*> strategies;
/**
* Singleton
diff --git a/src/base/songloading/songloading_strategy_base_factory.cpp b/src/base/songloading/songloading_strategy_base_factory.cpp
index 9f8333b4..7b61ce9c 100644
--- a/src/base/songloading/songloading_strategy_base_factory.cpp
+++ b/src/base/songloading/songloading_strategy_base_factory.cpp
@@ -29,12 +29,12 @@
namespace usdx
{
- SongloadingStrategyBaseFactory::SongloadingStrategyBaseFactory(std::wstring fileextension) : fileextension(fileextension)
+ SongloadingStrategyBaseFactory::SongloadingStrategyBaseFactory(std::string fileextension) : fileextension(fileextension)
{
Songloader::get_instance()->add_strategy(this);
}
- std::wstring SongloadingStrategyBaseFactory::get_fileextension(void)
+ std::string SongloadingStrategyBaseFactory::get_fileextension(void)
{
return fileextension;
}
diff --git a/src/base/songloading/songloading_strategy_base_factory.hpp b/src/base/songloading/songloading_strategy_base_factory.hpp
index ae20b1ce..57eff0fb 100644
--- a/src/base/songloading/songloading_strategy_base_factory.hpp
+++ b/src/base/songloading/songloading_strategy_base_factory.hpp
@@ -41,14 +41,14 @@ namespace usdx
/// no copy
void operator=(SongloadingStrategyBaseFactory&) {};
- std::wstring fileextension;
+ std::string fileextension;
public:
- SongloadingStrategyBaseFactory(std::wstring fileextension);
+ SongloadingStrategyBaseFactory(std::string fileextension);
virtual ~SongloadingStrategyBaseFactory(void) {};
virtual SongloadingStrategy *get_songloader(void) = 0;
- std::wstring get_fileextension(void);
+ std::string get_fileextension(void);
};
};
diff --git a/src/base/songloading/songloading_strategy_txt.cpp b/src/base/songloading/songloading_strategy_txt.cpp
index b80289ee..a7d296a5 100644
--- a/src/base/songloading/songloading_strategy_txt.cpp
+++ b/src/base/songloading/songloading_strategy_txt.cpp
@@ -32,7 +32,6 @@
#include <boost/algorithm/string.hpp>
#include "songloading_strategy_txt.hpp"
-#include "utils/unicode_file.hpp"
#include "utils/locale_independent_float.hpp"
namespace usdx
@@ -49,16 +48,16 @@ namespace usdx
{
}
- std::pair<std::wstring, std::wstring> SongloadingStrategyTxt::split_header_field(std::wstring &line)
+ std::pair<std::string, std::string> SongloadingStrategyTxt::split_header_field(std::string &line)
{
- std::size_t pos = line.find(L':');
+ std::size_t pos = line.find(':');
- if (line[0] != L'#' || pos == std::wstring::npos) {
- LOG4CXX_DEBUG(log, L"Tried to parse invalid header line: '" << line << L"'");
+ if (line[0] != '#' || pos == std::string::npos) {
+ LOG4CXX_DEBUG(log, "Tried to parse invalid header line: '" << line << "'");
throw "Invalid header!";
}
- std::pair<std::wstring, std::wstring> result;
+ std::pair<std::string, std::string> result;
// copy the substring until ':', without # to result.first and
// transform to upper case
@@ -74,16 +73,16 @@ namespace usdx
// line is already rtrimmed
boost::trim_left(result.second);
- LOG4CXX_DEBUG(log, L"Found header: '" << result.first << L"' with value '" << result.second << L"'");
+ LOG4CXX_DEBUG(log, "Found header: '" << result.first << "' with value '" << result.second << "'");
return result;
}
Song* SongloadingStrategyTxt::load_song(Song *song)
{
- LOG4CXX_DEBUG(log, L"Starting loading song from file: " << song->get_filename());
+ LOG4CXX_DEBUG(log, "Starting loading song from file: " << song->get_filename());
- UnicodeFile file(song->get_filename());
+ TextFile file(song->get_filename());
int line_number = 0;
while (file.stream().good() && parse_line(song, file, ++line_number));
@@ -93,52 +92,52 @@ namespace usdx
return song;
}
- bool SongloadingStrategyTxt::parse_line(Song* song, UnicodeFile& file, const int line_number)
+ bool SongloadingStrategyTxt::parse_line(Song* song, TextFile& file, const int line_number)
{
try {
- std::wstring line;
+ std::string line;
std::getline(file.stream(), line);
- wchar_t type;
- std::wistringstream linestream(line);
+ char type;
+ std::istringstream linestream(line);
linestream >> std::skipws >> type;
- if (type == L'#') {
+ if (type == '#') {
// ignore, header already read
}
- else if (type == L'E') {
+ else if (type == 'E') {
// song end
if (file.stream().eof()) {
- LOG4CXX_WARN(log, L"End marker found in line " << line_number <<
- L" before end of file: '" << song->get_filename() << L"'.");
+ LOG4CXX_WARN(log, "End marker found in line " << line_number <<
+ " before end of file: '" << song->get_filename() << "'.");
}
return false;
}
- else if (type == L'-') {
+ else if (type == '-') {
parse_newline(song, linestream, line_number);
}
- else if (type == L'B') {
+ else if (type == 'B') {
parse_bpm(song, linestream, line_number);
}
- else if (type == L':' || type == L'F' || type == L'*') {
+ else if (type == ':' || type == 'F' || type == '*') {
parse_note(song, type, linestream, line_number);
}
else {
- LOG4CXX_WARN(log, L"Unknown line in song: '" << line <<
- L"' in file: " << song->get_filename() <<
- L" at line " << line_number);
+ LOG4CXX_WARN(log, "Unknown line in song: '" << line <<
+ "' in file: " << song->get_filename() <<
+ " at line " << line_number);
}
}
catch (std::exception &e) {
- LOG4CXX_WARN(log, L"Error in song file at line " <<
- line_number << L": " << e.what());
+ LOG4CXX_WARN(log, "Error in song file at line " <<
+ line_number << ": " << e.what());
}
return true;
}
- void SongloadingStrategyTxt::parse_newline(Song *song, std::wistringstream& linestream, const int line_number)
+ void SongloadingStrategyTxt::parse_newline(Song *song, std::istringstream& linestream, const int line_number)
{
// line break
int line_out, line_in = -1;
@@ -146,54 +145,54 @@ namespace usdx
linestream >> line_out;
if (linestream.good()) {
linestream >> line_in;
- LOG4CXX_DEBUG(log, L"Found newline in line " <<
- line_number << L" with out of last line with " <<
- line_out << L" and in of next line " << line_in);
+ LOG4CXX_DEBUG(log, "Found newline in line " <<
+ line_number << " with out of last line with " <<
+ line_out << " and in of next line " << line_in);
}
else {
- LOG4CXX_DEBUG(log, L"Found newline in line " <<
- line_number << L" with out of last line with " <<
+ LOG4CXX_DEBUG(log, "Found newline in line " <<
+ line_number << " with out of last line with " <<
line_out);
}
song->new_line(line_out, line_in);
}
- void SongloadingStrategyTxt::parse_bpm(Song *song, std::wistringstream& linestream, const int line_number)
+ void SongloadingStrategyTxt::parse_bpm(Song *song, std::istringstream& linestream, const int line_number)
{
// new bpm
int beat;
LocaleIndependentFloat new_bpm;
linestream >> beat >> new_bpm;
- LOG4CXX_DEBUG(log, L"Found new bpm in line " <<
- line_number << L" starting at beat: " <<
- beat << L" and new bpm of " << new_bpm.get_value());
+ LOG4CXX_DEBUG(log, "Found new bpm in line " <<
+ line_number << " starting at beat: " <<
+ beat << " and new bpm of " << new_bpm.get_value());
song->new_bpm(beat, new_bpm.get_value());
}
- void SongloadingStrategyTxt::parse_note(Song *song, wchar_t type, std::wistringstream& linestream, const int line_number)
+ void SongloadingStrategyTxt::parse_note(Song *song, char type, std::istringstream& linestream, const int line_number)
{
// normal line
int beat, length, height;
- std::wstring lyric;
+ std::string lyric;
linestream >> beat >> length >> height >> std::noskipws;
linestream.ignore();
getline(linestream, lyric);
boost::trim_right_if(lyric, boost::is_cntrl());
- LOG4CXX_DEBUG(log, L"Found lyric: '" << lyric << L"' at line: " << line_number <<
- L" at beat: " << beat << L" with length: " << length <<
- L" at height: " << height);
+ LOG4CXX_DEBUG(log, "Found lyric: '" << lyric << "' at line: " << line_number <<
+ " at beat: " << beat << " with length: " << length <<
+ " at height: " << height);
song->new_note(type, beat, length, height, lyric);
}
Song* SongloadingStrategyTxt::load_header(const boost::filesystem::wpath& filename)
{
- UnicodeFile file(filename);
- std::wstring line;
- std::map<std::wstring, std::wstring> header_fields;
+ TextFile file(filename);
+ std::string line;
+ std::map<std::string, std::string> header_fields;
bool header = true, notes_found = false;
while (file.stream().good()) {
@@ -201,9 +200,9 @@ namespace usdx
boost::trim(line);
boost::trim_if(line, boost::is_cntrl());
- LOG4CXX_DEBUG(log, L"Line: " << line);
+ LOG4CXX_DEBUG(log, "Line: " << line);
- if (header && line[0] == L'#') {
+ if (header && line[0] == '#') {
// header
header_fields.insert(split_header_field(line));
@@ -214,7 +213,7 @@ namespace usdx
header = false;
}
- if (line[0] == L':' || line[0] == L'*' || line[0] == L'F') {
+ if (line[0] == ':' || line[0] == '*' || line[0] == 'F') {
notes_found = true;
break;
}
@@ -222,7 +221,7 @@ namespace usdx
}
if (! notes_found) {
- LOG4CXX_WARN(log, L"Song: '" << filename << L"' has no notes. Ignoring!");
+ LOG4CXX_WARN(log, "Song: '" << filename << "' has no notes. Ignoring!");
throw "No notes.";
}
diff --git a/src/base/songloading/songloading_strategy_txt.hpp b/src/base/songloading/songloading_strategy_txt.hpp
index 6177a5d3..293c65e6 100644
--- a/src/base/songloading/songloading_strategy_txt.hpp
+++ b/src/base/songloading/songloading_strategy_txt.hpp
@@ -32,7 +32,7 @@
#include <log4cxx/logger.h>
#include "songloading_strategy.hpp"
#include "songloading_strategy_factory.hpp"
-#include "utils/unicode_file.hpp"
+#include "utils/text_file.hpp"
namespace usdx
{
@@ -44,21 +44,21 @@ namespace usdx
/**
* Split the header field in name and value.
*/
- std::pair<std::wstring, std::wstring> split_header_field(std::wstring &line);
+ std::pair<std::string, std::string> split_header_field(std::string &line);
- bool parse_line(Song* song, UnicodeFile& file, const int line_number);
- void parse_newline(Song* song, std::wistringstream& linestream, const int line_number);
- void parse_bpm(Song* song, std::wistringstream& linestream, const int line_number);
- void parse_note(Song* song, wchar_t type, std::wistringstream& linestream, const int line_number);
+ bool parse_line(Song* song, TextFile& file, const int line_number);
+ void parse_newline(Song* song, std::istringstream& linestream, const int line_number);
+ void parse_bpm(Song* song, std::istringstream& linestream, const int line_number);
+ void parse_note(Song* song, char type, std::istringstream& linestream, const int line_number);
public:
SongloadingStrategyTxt();
virtual ~SongloadingStrategyTxt();
virtual Song* load_song(Song* song);
- virtual Song* load_header(const boost::filesystem::wpath& filename);
+ virtual Song* load_header(const boost::filesystem::path& filename);
- static std::wstring get_fileextension(void) { return L".txt"; };
+ static std::string get_fileextension(void) { return ".txt"; };
};
REGISTER_SONGLOADING_STRATEGY(SongloadingStrategyTxt);
diff --git a/src/base/songloading/songloading_strategy_xml.hpp b/src/base/songloading/songloading_strategy_xml.hpp
index 38637646..17ccd034 100644
--- a/src/base/songloading/songloading_strategy_xml.hpp
+++ b/src/base/songloading/songloading_strategy_xml.hpp
@@ -42,7 +42,7 @@ namespace usdx
virtual Song* load_song(Song* song);
virtual Song* load_header(const boost::filesystem::wpath& filename);
- static std::wstring get_fileextension(void) { return L".xml"; };
+ static std::string get_fileextension(void) { return ".xml"; };
};
REGISTER_SONGLOADING_STRATEGY(SongloadingStrategyXml);
diff --git a/src/base/stats.hpp b/src/base/stats.hpp
index d6bb48ad..b3068024 100644
--- a/src/base/stats.hpp
+++ b/src/base/stats.hpp
@@ -69,7 +69,7 @@ namespace usdx
/**
* TODO
*/
- static int get_count(std::wstring query);
+ static int get_count(std::string query);
public:
/**
@@ -111,27 +111,27 @@ namespace usdx
class StatResultBestScores : public Stats
{
private:
- std::wstring singer;
+ std::string singer;
unsigned short score;
unsigned short difficulty;
- std::wstring song_artist;
- std::wstring song_title;
+ std::string song_artist;
+ std::string song_title;
time_t date;
StatResultBestScores *next;
StatResultBestScores(
- wchar_t *singer,
+ char *singer,
unsigned short score,
unsigned short difficulty,
- wchar_t* song_artist,
- wchar_t* song_title,
+ char* song_artist,
+ char* song_title,
time_t date);
public:
/**
* TODO
*/
- StatResultBestScores(wchar_t* song_artist, wchar_t* song_title);
+ StatResultBestScores(char* song_artist, char* song_title);
~StatResultBestScores(void);
@@ -145,12 +145,12 @@ namespace usdx
class StatResultBestSingers : public Stats
{
private:
- std::wstring singer;
+ std::string singer;
unsigned short average_score;
StatResultBestSingers *next;
- StatResultBestSingers(wchar_t *singer, unsigned short average_score);
+ StatResultBestSingers(char *singer, unsigned short average_score);
public:
~StatResultBestSingers(void);
@@ -164,13 +164,13 @@ namespace usdx
class StatResultMostSungSong : public Stats
{
private:
- std::wstring song_artist;
- std::wstring song_title;
+ std::string song_artist;
+ std::string song_title;
unsigned short times_sung;
StatResultMostSungSong *next;
- StatResultMostSungSong(wchar_t* song_artist, wchar_t* song_title, unsigned short times_sung);
+ StatResultMostSungSong(char* song_artist, char* song_title, unsigned short times_sung);
public:
~StatResultMostSungSong(void);
@@ -184,12 +184,12 @@ namespace usdx
class StatResultMostSungBand : public Stats
{
private:
- std::wstring song_artist;
+ std::string song_artist;
unsigned short times_sung;
StatResultMostSungBand *next;
- StatResultMostSungBand(wchar_t* song_artist, unsigned short times_sung);
+ StatResultMostSungBand(char* song_artist, unsigned short times_sung);
public:
~StatResultMostSungBand(void);
diff --git a/src/base/texture.cpp b/src/base/texture.cpp
index 1b9ed970..ee26a5c8 100644
--- a/src/base/texture.cpp
+++ b/src/base/texture.cpp
@@ -41,12 +41,12 @@ namespace usdx
// // Check that the image dimensions are a power of 2
// if ((image.get_surface()->w & (image.get_surface()->w - 1)) != 0 ) {
- // LOG4CXX_ERROR(log, L"" << filename << L" has a width of " << image.get_surface()->w << L" that is not a power of 2");
+ // LOG4CXX_ERROR(log, "" << filename << " has a width of " << image.get_surface()->w << " that is not a power of 2");
// throw TextureSizeException(size);
// }
// if ((image.get_surface()->h & (image.get_surface()->h - 1)) != 0 ) {
- // LOG4CXX_ERROR(log, L"" << filename << L" has a height of " << image.get_surface()->h << L" that is not a power of 2");
+ // LOG4CXX_ERROR(log, "" << filename << " has a height of " << image.get_surface()->h << " that is not a power of 2");
// throw TextureSizeException(size);
// }
@@ -73,7 +73,7 @@ namespace usdx
break;
default:
- LOG4CXX_ERROR(log, L"" << filename << L" is not in true color! Could not handle that!");
+ LOG4CXX_ERROR(log, "" << filename << " is not in true color! Could not handle that!");
throw TextureColorDepthException(image.get_surface()->format->BytesPerPixel);
}
diff --git a/src/frames/loading_frame.cpp b/src/frames/loading_frame.cpp
index cf1f0382..afaa7d0b 100644
--- a/src/frames/loading_frame.cpp
+++ b/src/frames/loading_frame.cpp
@@ -30,12 +30,15 @@
namespace usdx
{
+ log4cxx::LoggerPtr LoadingFrame::log =
+ log4cxx::Logger::getLogger("usdx.frames.loading_frame");
+
LoadingFrame::LoadingFrame() :
Frame(NULL)
{
// RgbColor background(100, 100, 100);
// set_background(new FrameBackgroundColor(background));
- set_background(new FrameBackgroundImage(L"game/themes/Deluxe/[bg-load]blue.jpg"));
+ set_background(new FrameBackgroundImage("game/themes/Deluxe/[bg-load]blue.jpg"));
}
LoadingFrame::~LoadingFrame()
diff --git a/src/frames/loading_frame.hpp b/src/frames/loading_frame.hpp
index cf8864e4..5ddf0bf4 100644
--- a/src/frames/loading_frame.hpp
+++ b/src/frames/loading_frame.hpp
@@ -28,11 +28,15 @@
#define LOADING_FRAME_HPP
#include "frame.hpp"
+#include <log4cxx/logger.h>
namespace usdx
{
class LoadingFrame : public Frame
{
+ private:
+ static log4cxx::LoggerPtr log;
+
public:
LoadingFrame();
virtual ~LoadingFrame();
diff --git a/src/menu/application.cpp b/src/menu/application.cpp
index 089388c0..37e532a2 100644
--- a/src/menu/application.cpp
+++ b/src/menu/application.cpp
@@ -119,7 +119,7 @@ namespace usdx
repaint();
SDL_GL_SwapBuffers();
- LOG4CXX_TRACE(log, L"repaint");
+ LOG4CXX_TRACE(log, "repaint");
// poll current events
while (event_manager.available() && SDL_PollEvent(&event)) {
@@ -185,7 +185,7 @@ namespace usdx
}
if (! display) {
- LOG4CXX_ERROR(log, L"SDL_SetVideoMode failed.");
+ LOG4CXX_ERROR(log, "SDL_SetVideoMode failed.");
throw new std::exception();
}
diff --git a/src/menu/event_manager.cpp b/src/menu/event_manager.cpp
index 6d607e6d..8f09f202 100644
--- a/src/menu/event_manager.cpp
+++ b/src/menu/event_manager.cpp
@@ -100,7 +100,7 @@ namespace usdx
switch (event.type) {
case SDL_KEYDOWN:
- LOG4CXX_ERROR(log, L"key");
+ LOG4CXX_ERROR(log, "key");
break;
case SDL_MOUSEMOTION:
diff --git a/src/menu/software_mouse_pointer.cpp b/src/menu/software_mouse_pointer.cpp
index 1723ce9b..c0787e05 100644
--- a/src/menu/software_mouse_pointer.cpp
+++ b/src/menu/software_mouse_pointer.cpp
@@ -72,8 +72,8 @@ namespace usdx
this->texture[6] = 0.0f;
this->texture[7] = 0.0f;
- texture_normal = new Texture(L"game/themes/Deluxe/interface/cursor.png");
- texture_pressed = new Texture(L"game/themes/Deluxe/interface/cursor_pressed.png");
+ texture_normal = new Texture("game/themes/Deluxe/interface/cursor.png");
+ texture_pressed = new Texture("game/themes/Deluxe/interface/cursor_pressed.png");
mouse_move_connection = event_manager->mouse_move.connect(
boost::bind(&SoftwareMousePointer::on_mouse_move, this, _1, _2));
diff --git a/src/utils/locale_independent_float.cpp b/src/utils/locale_independent_float.cpp
index 606ec998..e0015cee 100644
--- a/src/utils/locale_independent_float.cpp
+++ b/src/utils/locale_independent_float.cpp
@@ -38,7 +38,7 @@ namespace usdx
{
}
- LocaleIndependentFloat::LocaleIndependentFloat(std::wstring& value)
+ LocaleIndependentFloat::LocaleIndependentFloat(std::string& value)
{
this->operator=(value);
}
@@ -65,27 +65,27 @@ namespace usdx
return *this;
}
- LocaleIndependentFloat& LocaleIndependentFloat::operator= (std::wstring& value)
+ LocaleIndependentFloat& LocaleIndependentFloat::operator= (std::string& value)
{
- std::size_t found = value.find(L',');
- if (found != std::wstring::npos) {
- value[found] = L'.';
+ std::size_t found = value.find(',');
+ if (found != std::string::npos) {
+ value[found] = '.';
}
- std::wistringstream str(value);
+ std::istringstream str(value);
str >> this->value;
return *this;
}
- std::wistream& operator>> (std::wistream& is, LocaleIndependentFloat& float_value)
+ std::istream& operator>> (std::istream& is, LocaleIndependentFloat& float_value)
{
return is >> &float_value;
}
- std::wistream& operator>> (std::wistream& is, LocaleIndependentFloat* float_value)
+ std::istream& operator>> (std::istream& is, LocaleIndependentFloat* float_value)
{
- std::wstring str_value;
+ std::string str_value;
is >> str_value;
*float_value = str_value;
diff --git a/src/utils/locale_independent_float.hpp b/src/utils/locale_independent_float.hpp
index f3674695..82801868 100644
--- a/src/utils/locale_independent_float.hpp
+++ b/src/utils/locale_independent_float.hpp
@@ -37,7 +37,7 @@ namespace usdx
float value;
public:
LocaleIndependentFloat();
- LocaleIndependentFloat(std::wstring& value);
+ LocaleIndependentFloat(std::string& value);
virtual ~LocaleIndependentFloat();
@@ -46,11 +46,11 @@ namespace usdx
LocaleIndependentFloat& operator= (const LocaleIndependentFloat& value);
LocaleIndependentFloat& operator= (const float& vaule);
- LocaleIndependentFloat& operator= (std::wstring& vaule);
+ LocaleIndependentFloat& operator= (std::string& vaule);
};
- std::wistream& operator>> (std::wistream& is, LocaleIndependentFloat& float_value);
- std::wistream& operator>> (std::wistream& is, LocaleIndependentFloat* float_value);
+ std::istream& operator>> (std::istream& is, LocaleIndependentFloat& float_value);
+ std::istream& operator>> (std::istream& is, LocaleIndependentFloat* float_value);
};
diff --git a/src/utils/unicode_file.cpp b/src/utils/text_file.cpp
index c47bfd36..b84c667f 100644
--- a/src/utils/unicode_file.cpp
+++ b/src/utils/text_file.cpp
@@ -24,7 +24,7 @@
* $Id$
*/
-#include "unicode_file.hpp"
+#include "text_file.hpp"
#include <string>
#include <locale>
@@ -32,31 +32,31 @@
namespace usdx
{
- UnicodeFile::UnicodeFile(const std::string& filename) : file(filename.c_str(), std::wifstream::in)
+ TextFile::TextFile(const std::string& filename) : file(filename.c_str(), std::ifstream::in)
{
std::locale global_loc = std::locale();
std::locale loc(global_loc, new boost::program_options::detail::utf8_codecvt_facet());
file.imbue(loc);
}
- UnicodeFile::UnicodeFile(const boost::filesystem::wpath& path) : file(path, std::wifstream::in)
+ TextFile::TextFile(const boost::filesystem::wpath& path) : file(path, std::wifstream::in)
{
std::locale global_loc = std::locale();
std::locale loc(global_loc, new boost::program_options::detail::utf8_codecvt_facet());
file.imbue(loc);
}
- UnicodeFile::~UnicodeFile(void)
+ TextFile::~TextFile(void)
{
file.close();
}
- boost::filesystem::wifstream &UnicodeFile::stream(void)
+ boost::filesystem::ifstream &TextFile::stream(void)
{
return file;
}
- const std::streamsize UnicodeFile::get_filesize(void)
+ const std::streamsize TextFile::get_filesize(void)
{
std::streampos position = stream().tellg();
diff --git a/src/utils/unicode_file.hpp b/src/utils/text_file.hpp
index d135d796..b5249035 100644
--- a/src/utils/unicode_file.hpp
+++ b/src/utils/text_file.hpp
@@ -24,8 +24,8 @@
* $Id$
*/
-#ifndef UNICODE_FILE_HPP
-#define UNICODE_FILE_HPP
+#ifndef TEXT_FILE_HPP
+#define TEXT_FILE_HPP
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
@@ -33,17 +33,17 @@
namespace usdx
{
- class UnicodeFile : public File
+ class TextFile : public File
{
private:
- boost::filesystem::wifstream file;
+ boost::filesystem::ifstream file;
public:
- UnicodeFile(const std::string& filename);
- UnicodeFile(const boost::filesystem::wpath& path);
- virtual ~UnicodeFile(void);
+ TextFile(const std::string& filename);
+ TextFile(const boost::filesystem::wpath& path);
+ virtual ~TextFile(void);
- boost::filesystem::wifstream &stream(void);
+ boost::filesystem::ifstream &stream(void);
const std::streamsize get_filesize(void);
};
};