mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-09 21:40:08 +00:00
Remove base::string (std::string is good enough for utf8 strings)
This commit is contained in:
parent
3322396357
commit
b33357ed46
@ -145,9 +145,9 @@ App::App(int argc, const char* argv[])
|
||||
RenderEngine::loadConfig();
|
||||
|
||||
// Default palette.
|
||||
base::string palFile(!options.paletteFileName().empty() ?
|
||||
options.paletteFileName():
|
||||
base::string(get_config_string("GfxMode", "Palette", "")));
|
||||
std::string palFile(!options.paletteFileName().empty() ?
|
||||
options.paletteFileName():
|
||||
std::string(get_config_string("GfxMode", "Palette", "")));
|
||||
|
||||
if (palFile.empty()) {
|
||||
// Try to use a default pixel art palette.
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "base/unique_ptr.h"
|
||||
#include "raster/pixel_format.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ui {
|
||||
@ -80,7 +81,7 @@ namespace app {
|
||||
Signal0<void> CurrentToolChange;
|
||||
|
||||
private:
|
||||
typedef std::vector<base::string> FileList;
|
||||
typedef std::vector<std::string> FileList;
|
||||
class Modules;
|
||||
|
||||
static App* m_instance;
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
namespace app {
|
||||
|
||||
Backup::Backup(const base::string& path)
|
||||
Backup::Backup(const std::string& path)
|
||||
: m_path(path)
|
||||
{
|
||||
}
|
||||
|
@ -21,14 +21,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "base/disable_copying.h"
|
||||
#include "base/string.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace app {
|
||||
|
||||
// A class to record/restore backup information.
|
||||
class Backup {
|
||||
public:
|
||||
Backup(const base::string& path);
|
||||
Backup(const std::string& path);
|
||||
~Backup();
|
||||
|
||||
// Returns true if there are items that can be restored.
|
||||
@ -37,7 +38,7 @@ namespace app {
|
||||
private:
|
||||
DISABLE_COPYING(Backup);
|
||||
|
||||
base::string m_path;
|
||||
std::string m_path;
|
||||
};
|
||||
|
||||
} // namespace app
|
||||
|
@ -73,7 +73,7 @@ void DuplicateSpriteCommand::onExecute(Context* context)
|
||||
dst_name = window->findChild("dst_name");
|
||||
flatten = window->findChild("flatten");
|
||||
|
||||
base::string fn = document->getFilename();
|
||||
std::string fn = document->getFilename();
|
||||
src_name->setText(base::get_file_name(fn));
|
||||
dst_name->setText(base::get_file_title(fn) + " Copy." + base::get_file_extension(fn));
|
||||
|
||||
|
@ -70,7 +70,7 @@ void LoadMaskCommand::onExecute(Context* context)
|
||||
{
|
||||
const ContextReader reader(context);
|
||||
|
||||
base::string filename = m_filename;
|
||||
std::string filename = m_filename;
|
||||
|
||||
if (context->isUiAvailable()) {
|
||||
filename = app::show_file_selector("Load .msk File", filename, "msk");
|
||||
|
@ -52,7 +52,7 @@ LoadPaletteCommand::LoadPaletteCommand()
|
||||
|
||||
void LoadPaletteCommand::onExecute(Context* context)
|
||||
{
|
||||
base::string filename = app::show_file_selector("Load Palette", "", "png,pcx,bmp,tga,lbm,col,gpl");
|
||||
std::string filename = app::show_file_selector("Load Palette", "", "png,pcx,bmp,tga,lbm,col,gpl");
|
||||
if (!filename.empty()) {
|
||||
base::UniquePtr<raster::Palette> palette(raster::Palette::load(filename.c_str()));
|
||||
if (!palette) {
|
||||
|
@ -122,7 +122,7 @@ protected:
|
||||
void saveAsDialog(const ContextReader& reader, const char* dlgTitle, bool markAsSaved)
|
||||
{
|
||||
const Document* document = reader.document();
|
||||
base::string filename;
|
||||
std::string filename;
|
||||
|
||||
if (!m_filename.empty()) {
|
||||
filename = m_filename;
|
||||
@ -134,7 +134,7 @@ protected:
|
||||
get_writable_extensions(exts, sizeof(exts));
|
||||
|
||||
for (;;) {
|
||||
base::string newfilename = app::show_file_selector(dlgTitle, filename, exts);
|
||||
std::string newfilename = app::show_file_selector(dlgTitle, filename, exts);
|
||||
if (newfilename.empty())
|
||||
return;
|
||||
|
||||
@ -283,7 +283,7 @@ void SaveFileCopyAsCommand::onExecute(Context* context)
|
||||
{
|
||||
const ContextReader reader(context);
|
||||
const Document* document(reader.document());
|
||||
base::string old_filename = document->getFilename();
|
||||
std::string old_filename = document->getFilename();
|
||||
|
||||
// show "Save As" dialog
|
||||
saveAsDialog(reader, "Save Copy As", false);
|
||||
|
@ -58,7 +58,7 @@ void SaveMaskCommand::onExecute(Context* context)
|
||||
{
|
||||
const ContextReader reader(context);
|
||||
const Document* document(reader.document());
|
||||
base::string filename = "default.msk";
|
||||
std::string filename = "default.msk";
|
||||
int ret;
|
||||
|
||||
for (;;) {
|
||||
|
@ -51,7 +51,7 @@ SavePaletteCommand::SavePaletteCommand()
|
||||
|
||||
void SavePaletteCommand::onExecute(Context* context)
|
||||
{
|
||||
base::string filename;
|
||||
std::string filename;
|
||||
int ret;
|
||||
|
||||
again:
|
||||
|
@ -67,7 +67,7 @@ bool SpritePropertiesCommand::onEnabled(Context* context)
|
||||
void SpritePropertiesCommand::onExecute(Context* context)
|
||||
{
|
||||
Widget* name, *type, *size, *frames, *ok, *box_transparent;
|
||||
base::string imgtype_text;
|
||||
std::string imgtype_text;
|
||||
char buf[256];
|
||||
ColorButton* color_button = NULL;
|
||||
|
||||
|
@ -138,7 +138,7 @@ void Console::printf(const char* format, ...)
|
||||
|
||||
const std::string& text = wid_textbox->getText();
|
||||
|
||||
base::string final;
|
||||
std::string final;
|
||||
if (!text.empty())
|
||||
final += text;
|
||||
final += buf;
|
||||
|
@ -39,7 +39,7 @@ DataRecovery::DataRecovery(Context* context)
|
||||
, m_context(context)
|
||||
{
|
||||
// Check if there is already data to recover
|
||||
const base::string existent_data_path = get_config_string("DataRecovery", "Path", "");
|
||||
const std::string existent_data_path = get_config_string("DataRecovery", "Path", "");
|
||||
if (!existent_data_path.empty() &&
|
||||
base::is_directory(existent_data_path)) {
|
||||
// Load the backup data.
|
||||
|
@ -189,7 +189,7 @@ void Document::notifyCelCopied(Layer* fromLayer, FrameNumber fromFrame, Layer* t
|
||||
notifyObservers<DocumentEvent&>(&DocumentObserver::onCelCopied, ev);
|
||||
}
|
||||
|
||||
void Document::setFilename(const base::string& filename)
|
||||
void Document::setFilename(const std::string& filename)
|
||||
{
|
||||
m_document.setFilename(filename);
|
||||
}
|
||||
|
@ -24,13 +24,14 @@
|
||||
#include "base/disable_copying.h"
|
||||
#include "base/observable.h"
|
||||
#include "base/shared_ptr.h"
|
||||
#include "base/string.h"
|
||||
#include "base/unique_ptr.h"
|
||||
#include "doc/document.h"
|
||||
#include "gfx/transformation.h"
|
||||
#include "raster/frame_number.h"
|
||||
#include "raster/pixel_format.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace base {
|
||||
class mutex;
|
||||
}
|
||||
@ -122,8 +123,8 @@ namespace app {
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// File related properties
|
||||
|
||||
const base::string& getFilename() const { return m_document.filename(); }
|
||||
void setFilename(const base::string& filename);
|
||||
const std::string& getFilename() const { return m_document.filename(); }
|
||||
void setFilename(const std::string& filename);
|
||||
|
||||
bool isModified() const;
|
||||
bool isAssociatedToFile() const;
|
||||
|
@ -194,7 +194,7 @@ void DocumentExporter::captureSamples(Samples& samples)
|
||||
|
||||
for (FrameNumber frame=FrameNumber(0);
|
||||
frame<sprite->getTotalFrames(); ++frame) {
|
||||
base::string filename = document->getFilename();
|
||||
std::string filename = document->getFilename();
|
||||
|
||||
if (sprite->getTotalFrames() > FrameNumber(1)) {
|
||||
int frameNumWidth =
|
||||
@ -203,9 +203,9 @@ void DocumentExporter::captureSamples(Samples& samples)
|
||||
(sprite->getTotalFrames() < 1000)? 3: 4;
|
||||
std::sprintf(&buf[0], "%0*d", frameNumWidth, (int)frame);
|
||||
|
||||
base::string path = base::get_file_path(filename);
|
||||
base::string title = base::get_file_title(filename);
|
||||
base::string ext = base::get_file_extension(filename);
|
||||
std::string path = base::get_file_path(filename);
|
||||
std::string title = base::get_file_title(filename);
|
||||
std::string ext = base::get_file_extension(filename);
|
||||
filename = base::join_path(path, title + &buf[0] + "." + ext);
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ FileOp* fop_to_load_document(const char* filename, int flags)
|
||||
return NULL;
|
||||
|
||||
// Get the extension of the filename (in lower case)
|
||||
base::string extension = base::string_to_lower(base::get_file_extension(filename));
|
||||
std::string extension = base::string_to_lower(base::get_file_extension(filename));
|
||||
|
||||
PRINTF("Loading file \"%s\" (%s)\n", filename, extension.c_str());
|
||||
|
||||
@ -244,7 +244,7 @@ FileOp* fop_to_save_document(Document* document)
|
||||
fop->document = document;
|
||||
|
||||
// Get the extension of the filename (in lower case)
|
||||
base::string extension = base::string_to_lower(base::get_file_extension(fop->document->getFilename()));
|
||||
std::string extension = base::string_to_lower(base::get_file_extension(fop->document->getFilename()));
|
||||
|
||||
PRINTF("Saving document \"%s\" (%s)\n",
|
||||
fop->document->getFilename().c_str(), extension.c_str());
|
||||
@ -258,7 +258,7 @@ FileOp* fop_to_save_document(Document* document)
|
||||
}
|
||||
|
||||
// Warnings
|
||||
base::string warnings;
|
||||
std::string warnings;
|
||||
fatal = false;
|
||||
|
||||
/* check image type support */
|
||||
|
@ -24,9 +24,9 @@
|
||||
|
||||
namespace app {
|
||||
|
||||
base::string show_file_selector(const base::string& title,
|
||||
const base::string& initialPath,
|
||||
const base::string& showExtensions)
|
||||
std::string show_file_selector(const std::string& title,
|
||||
const std::string& initialPath,
|
||||
const std::string& showExtensions)
|
||||
{
|
||||
FileSelector fileSelector;
|
||||
return fileSelector.show(title, initialPath, showExtensions);
|
||||
|
@ -20,13 +20,13 @@
|
||||
#define APP_FILE_SELECTOR_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "base/string.h"
|
||||
#include <string>
|
||||
|
||||
namespace app {
|
||||
|
||||
base::string show_file_selector(const base::string& title,
|
||||
const base::string& initialPath,
|
||||
const base::string& showExtensions);
|
||||
std::string show_file_selector(const std::string& title,
|
||||
const std::string& initialPath,
|
||||
const std::string& showExtensions);
|
||||
|
||||
} // namespace app
|
||||
|
||||
|
@ -105,9 +105,9 @@ namespace app {
|
||||
// a position in the file-system
|
||||
class FileItem : public IFileItem {
|
||||
public:
|
||||
base::string keyname;
|
||||
base::string filename;
|
||||
base::string displayname;
|
||||
std::string keyname;
|
||||
std::string filename;
|
||||
std::string displayname;
|
||||
FileItem* parent;
|
||||
FileItemList children;
|
||||
unsigned int version;
|
||||
@ -138,22 +138,22 @@ public:
|
||||
bool isFolder() const;
|
||||
bool isBrowsable() const;
|
||||
|
||||
base::string getKeyName() const;
|
||||
base::string getFileName() const;
|
||||
base::string getDisplayName() const;
|
||||
std::string getKeyName() const;
|
||||
std::string getFileName() const;
|
||||
std::string getDisplayName() const;
|
||||
|
||||
IFileItem* getParent() const;
|
||||
const FileItemList& getChildren();
|
||||
|
||||
bool hasExtension(const base::string& csv_extensions);
|
||||
bool hasExtension(const std::string& csv_extensions);
|
||||
|
||||
BITMAP* getThumbnail();
|
||||
void setThumbnail(BITMAP* thumbnail);
|
||||
|
||||
};
|
||||
|
||||
typedef std::map<base::string, FileItem*> FileItemMap;
|
||||
typedef std::map<base::string, BITMAP*> ThumbnailMap;
|
||||
typedef std::map<std::string, FileItem*> FileItemMap;
|
||||
typedef std::map<std::string, BITMAP*> ThumbnailMap;
|
||||
|
||||
// the root of the file-system
|
||||
static FileItem* rootitem = NULL;
|
||||
@ -180,15 +180,15 @@ static unsigned int current_file_system_version = 0;
|
||||
static LPITEMIDLIST clone_pidl(LPITEMIDLIST pidl);
|
||||
static LPITEMIDLIST remove_last_pidl(LPITEMIDLIST pidl);
|
||||
static void free_pidl(LPITEMIDLIST pidl);
|
||||
static base::string get_key_for_pidl(LPITEMIDLIST pidl);
|
||||
static std::string get_key_for_pidl(LPITEMIDLIST pidl);
|
||||
|
||||
static FileItem* get_fileitem_by_fullpidl(LPITEMIDLIST pidl, bool create_if_not);
|
||||
static void put_fileitem(FileItem* fileitem);
|
||||
#else
|
||||
static FileItem* get_fileitem_by_path(const base::string& path, bool create_if_not);
|
||||
static FileItem* get_fileitem_by_path(const std::string& path, bool create_if_not);
|
||||
static void for_each_child_callback(const char *filename, int attrib, int param);
|
||||
static base::string remove_backslash_if_needed(const base::string& filename);
|
||||
static base::string get_key_for_filename(const base::string& filename);
|
||||
static std::string remove_backslash_if_needed(const std::string& filename);
|
||||
static std::string get_key_for_filename(const std::string& filename);
|
||||
static void put_fileitem(FileItem* fileitem);
|
||||
#endif
|
||||
|
||||
@ -317,7 +317,7 @@ IFileItem* FileSystemModule::getRootFileItem()
|
||||
return fileitem;
|
||||
}
|
||||
|
||||
IFileItem* FileSystemModule::getFileItemFromPath(const base::string& path)
|
||||
IFileItem* FileSystemModule::getFileItemFromPath(const std::string& path)
|
||||
{
|
||||
IFileItem* fileitem = NULL;
|
||||
|
||||
@ -348,7 +348,7 @@ IFileItem* FileSystemModule::getFileItemFromPath(const base::string& path)
|
||||
}
|
||||
#else
|
||||
{
|
||||
base::string buf = remove_backslash_if_needed(path);
|
||||
std::string buf = remove_backslash_if_needed(path);
|
||||
fileitem = get_fileitem_by_path(buf, true);
|
||||
}
|
||||
#endif
|
||||
@ -358,11 +358,11 @@ IFileItem* FileSystemModule::getFileItemFromPath(const base::string& path)
|
||||
return fileitem;
|
||||
}
|
||||
|
||||
bool FileSystemModule::dirExists(const base::string& path)
|
||||
bool FileSystemModule::dirExists(const std::string& path)
|
||||
{
|
||||
struct al_ffblk info;
|
||||
int ret;
|
||||
base::string path2 = base::join_path(path, "*.*");
|
||||
std::string path2 = base::join_path(path, "*.*");
|
||||
|
||||
ret = al_findfirst(path2.c_str(), &info, FA_ALL);
|
||||
al_findclose(&info);
|
||||
@ -393,21 +393,21 @@ bool FileItem::isBrowsable() const
|
||||
#endif
|
||||
}
|
||||
|
||||
base::string FileItem::getKeyName() const
|
||||
std::string FileItem::getKeyName() const
|
||||
{
|
||||
ASSERT(this->keyname != NOTINITIALIZED);
|
||||
|
||||
return this->keyname;
|
||||
}
|
||||
|
||||
base::string FileItem::getFileName() const
|
||||
std::string FileItem::getFileName() const
|
||||
{
|
||||
ASSERT(this->filename != NOTINITIALIZED);
|
||||
|
||||
return this->filename;
|
||||
}
|
||||
|
||||
base::string FileItem::getDisplayName() const
|
||||
std::string FileItem::getDisplayName() const
|
||||
{
|
||||
ASSERT(this->displayname != NOTINITIALIZED);
|
||||
|
||||
@ -560,7 +560,7 @@ const FileItemList& FileItem::getChildren()
|
||||
return this->children;
|
||||
}
|
||||
|
||||
bool FileItem::hasExtension(const base::string& csv_extensions)
|
||||
bool FileItem::hasExtension(const std::string& csv_extensions)
|
||||
{
|
||||
ASSERT(this->filename != NOTINITIALIZED);
|
||||
|
||||
@ -873,7 +873,7 @@ static void free_pidl(LPITEMIDLIST pidl)
|
||||
shl_imalloc->Free(pidl);
|
||||
}
|
||||
|
||||
static base::string get_key_for_pidl(LPITEMIDLIST pidl)
|
||||
static std::string get_key_for_pidl(LPITEMIDLIST pidl)
|
||||
{
|
||||
#if 0
|
||||
char *key = base_malloc(get_pidl_size(pidl)+1);
|
||||
@ -995,7 +995,7 @@ static void put_fileitem(FileItem* fileitem)
|
||||
// Allegro for_each_file: Portable
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
static FileItem* get_fileitem_by_path(const base::string& path, bool create_if_not)
|
||||
static FileItem* get_fileitem_by_path(const std::string& path, bool create_if_not)
|
||||
{
|
||||
if (path.empty())
|
||||
return rootitem;
|
||||
@ -1024,7 +1024,7 @@ static FileItem* get_fileitem_by_path(const base::string& path, bool create_if_n
|
||||
|
||||
// get the parent
|
||||
{
|
||||
base::string parent_path = remove_backslash_if_needed(base::join_path(base::get_file_path(path), ""));
|
||||
std::string parent_path = remove_backslash_if_needed(base::join_path(base::get_file_path(path), ""));
|
||||
fileitem->parent = get_fileitem_by_path(parent_path, true);
|
||||
}
|
||||
|
||||
@ -1066,7 +1066,7 @@ static void for_each_child_callback(const char *filename, int attrib, int param)
|
||||
fileitem->insertChildSorted(child);
|
||||
}
|
||||
|
||||
static base::string remove_backslash_if_needed(const base::string& filename)
|
||||
static std::string remove_backslash_if_needed(const std::string& filename)
|
||||
{
|
||||
if (!filename.empty() && base::is_path_separator(*(filename.end()-1))) {
|
||||
int len = filename.size();
|
||||
@ -1085,9 +1085,9 @@ static base::string remove_backslash_if_needed(const base::string& filename)
|
||||
return filename;
|
||||
}
|
||||
|
||||
static base::string get_key_for_filename(const base::string& filename)
|
||||
static std::string get_key_for_filename(const std::string& filename)
|
||||
{
|
||||
base::string buf(filename);
|
||||
std::string buf(filename);
|
||||
|
||||
#if !defined CASE_SENSITIVE
|
||||
buf.tolower();
|
||||
|
@ -20,8 +20,7 @@
|
||||
#define APP_FILE_SYSTEM_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "base/string.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct BITMAP;
|
||||
@ -49,9 +48,9 @@ namespace app {
|
||||
|
||||
// Returns the FileItem through the specified "path".
|
||||
// Warning: You have to call path.fix_separators() before.
|
||||
IFileItem* getFileItemFromPath(const base::string& path);
|
||||
IFileItem* getFileItemFromPath(const std::string& path);
|
||||
|
||||
bool dirExists(const base::string& path);
|
||||
bool dirExists(const std::string& path);
|
||||
|
||||
};
|
||||
|
||||
@ -62,14 +61,14 @@ namespace app {
|
||||
virtual bool isFolder() const = 0;
|
||||
virtual bool isBrowsable() const = 0;
|
||||
|
||||
virtual base::string getKeyName() const = 0;
|
||||
virtual base::string getFileName() const = 0;
|
||||
virtual base::string getDisplayName() const = 0;
|
||||
virtual std::string getKeyName() const = 0;
|
||||
virtual std::string getFileName() const = 0;
|
||||
virtual std::string getDisplayName() const = 0;
|
||||
|
||||
virtual IFileItem* getParent() const = 0;
|
||||
virtual const FileItemList& getChildren() = 0;
|
||||
|
||||
virtual bool hasExtension(const base::string& csv_extensions) = 0;
|
||||
virtual bool hasExtension(const std::string& csv_extensions) = 0;
|
||||
|
||||
virtual BITMAP* getThumbnail() = 0;
|
||||
virtual void setThumbnail(BITMAP* thumbnail) = 0;
|
||||
|
@ -52,7 +52,7 @@ GuiXml::GuiXml()
|
||||
m_doc = app::open_xml(rf.filename());
|
||||
}
|
||||
|
||||
base::string GuiXml::version()
|
||||
std::string GuiXml::version()
|
||||
{
|
||||
TiXmlHandle handle(m_doc);
|
||||
TiXmlElement* xmlKey = handle.FirstChild("gui").ToElement();
|
||||
|
@ -21,7 +21,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "app/xml_document.h"
|
||||
#include "base/string.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace app {
|
||||
|
||||
@ -43,7 +44,7 @@ namespace app {
|
||||
return m_doc->Value();
|
||||
}
|
||||
|
||||
base::string version();
|
||||
std::string version();
|
||||
|
||||
private:
|
||||
GuiXml();
|
||||
|
@ -64,7 +64,7 @@ RecentFiles::RecentFiles()
|
||||
const_iterator it = files_begin();
|
||||
const_iterator end = files_end();
|
||||
for (; it != end; ++it) {
|
||||
base::string path = base::get_file_path(*it);
|
||||
std::string path = base::get_file_path(*it);
|
||||
|
||||
// Check if the path was not already included in the list
|
||||
if (included.find(path) == included.end()) {
|
||||
|
@ -21,13 +21,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "base/recent_items.h"
|
||||
#include "base/string.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace app {
|
||||
|
||||
class RecentFiles {
|
||||
public:
|
||||
typedef base::RecentItems<base::string> List;
|
||||
typedef base::RecentItems<std::string> List;
|
||||
typedef List::iterator iterator;
|
||||
typedef List::const_iterator const_iterator;
|
||||
|
||||
|
@ -23,10 +23,11 @@
|
||||
#include "app/file_system.h"
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/signal.h"
|
||||
#include "base/string.h"
|
||||
#include "ui/timer.h"
|
||||
#include "ui/widget.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace app {
|
||||
|
||||
class FileList : public ui::Widget {
|
||||
@ -71,7 +72,7 @@ namespace app {
|
||||
bool m_req_valid;
|
||||
int m_req_w, m_req_h;
|
||||
IFileItem* m_selected;
|
||||
base::string m_exts;
|
||||
std::string m_exts;
|
||||
|
||||
// Incremental-search
|
||||
std::string m_isearch;
|
||||
|
@ -119,7 +119,7 @@ protected:
|
||||
}
|
||||
|
||||
// String to be autocompleted
|
||||
base::string left_part = getText();
|
||||
std::string left_part = getText();
|
||||
if (left_part.empty())
|
||||
return false;
|
||||
|
||||
@ -128,9 +128,9 @@ protected:
|
||||
for (FileItemList::const_iterator
|
||||
it=children.begin(); it!=children.end(); ++it) {
|
||||
IFileItem* child = *it;
|
||||
base::string child_name = child->getDisplayName();
|
||||
std::string child_name = child->getDisplayName();
|
||||
|
||||
base::string::iterator it1, it2;
|
||||
std::string::iterator it1, it2;
|
||||
|
||||
for (it1 = child_name.begin(), it2 = left_part.begin();
|
||||
it1!=child_name.end() && it2!=left_part.end();
|
||||
@ -247,11 +247,11 @@ FileSelector::FileSelector()
|
||||
m_fileList->CurrentFolderChanged.connect(Bind<void>(&FileSelector::onFileListCurrentFolderChanged, this));
|
||||
}
|
||||
|
||||
base::string FileSelector::show(const base::string& title,
|
||||
const base::string& initialPath,
|
||||
const base::string& showExtensions)
|
||||
std::string FileSelector::show(const std::string& title,
|
||||
const std::string& initialPath,
|
||||
const std::string& showExtensions)
|
||||
{
|
||||
base::string result;
|
||||
std::string result;
|
||||
|
||||
FileSystemModule::instance()->refresh();
|
||||
|
||||
@ -261,13 +261,13 @@ base::string FileSelector::show(const base::string& title,
|
||||
}
|
||||
|
||||
// we have to find where the user should begin to browse files (start_folder)
|
||||
base::string start_folder_path;
|
||||
std::string start_folder_path;
|
||||
IFileItem* start_folder = NULL;
|
||||
|
||||
// If initialPath doesn't contain a path.
|
||||
if (base::get_file_path(initialPath).empty()) {
|
||||
// Get the saved `path' in the configuration file.
|
||||
base::string path = get_config_string("FileSelect", "CurrentDirectory", "");
|
||||
std::string path = get_config_string("FileSelect", "CurrentDirectory", "");
|
||||
start_folder = FileSystemModule::instance()->getFileItemFromPath(path);
|
||||
|
||||
// Is the folder find?
|
||||
@ -318,8 +318,8 @@ base::string FileSelector::show(const base::string& title,
|
||||
// fill file-type combo-box
|
||||
m_fileType->removeAllItems();
|
||||
|
||||
std::vector<base::string> tokens;
|
||||
std::vector<base::string>::iterator tok;
|
||||
std::vector<std::string> tokens;
|
||||
std::vector<std::string>::iterator tok;
|
||||
|
||||
base::split_string(showExtensions, tokens, ",");
|
||||
for (tok=tokens.begin(); tok!=tokens.end(); ++tok)
|
||||
@ -348,8 +348,8 @@ again:
|
||||
IFileItem* folder = m_fileList->getCurrentFolder();
|
||||
ASSERT(folder);
|
||||
|
||||
base::string fn = m_fileName->getText();
|
||||
base::string buf;
|
||||
std::string fn = m_fileName->getText();
|
||||
std::string buf;
|
||||
IFileItem* enter_folder = NULL;
|
||||
|
||||
// up a level?
|
||||
@ -362,7 +362,7 @@ again:
|
||||
// check if the user specified in "fn" a item of "fileview"
|
||||
const FileItemList& children = m_fileList->getFileList();
|
||||
|
||||
base::string fn2 = fn;
|
||||
std::string fn2 = fn;
|
||||
#ifdef WIN32
|
||||
fn2 = base::string_to_lower(fn2);
|
||||
#endif
|
||||
@ -370,7 +370,7 @@ again:
|
||||
for (FileItemList::const_iterator
|
||||
it=children.begin(); it!=children.end(); ++it) {
|
||||
IFileItem* child = *it;
|
||||
base::string child_name = child->getDisplayName();
|
||||
std::string child_name = child->getDisplayName();
|
||||
|
||||
#ifdef WIN32
|
||||
child_name = base::string_to_lower(child_name);
|
||||
@ -387,7 +387,7 @@ again:
|
||||
if (base::is_path_separator(*fn.begin())) { // absolute path (UNIX style)
|
||||
#ifdef WIN32
|
||||
// get the drive of the current folder
|
||||
base::string drive = folder->getFileName();
|
||||
std::string drive = folder->getFileName();
|
||||
if (drive.size() >= 2 && drive[1] == ':') {
|
||||
buf += drive[0];
|
||||
buf += ':';
|
||||
@ -401,7 +401,7 @@ again:
|
||||
}
|
||||
#ifdef WIN32
|
||||
// does the file-name entry have colon?
|
||||
else if (fn.find(':') != base::string::npos) { // absolute path on Windows
|
||||
else if (fn.find(':') != std::string::npos) { // absolute path on Windows
|
||||
if (fn.size() == 2 && fn[1] == ':') {
|
||||
buf = base::join_path(fn, "");
|
||||
}
|
||||
@ -453,7 +453,7 @@ again:
|
||||
result = buf;
|
||||
|
||||
// save the path in the configuration file
|
||||
base::string lastpath = folder->getKeyName();
|
||||
std::string lastpath = folder->getKeyName();
|
||||
set_config_string("FileSelect", "CurrentDirectory",
|
||||
lastpath.c_str());
|
||||
}
|
||||
@ -486,7 +486,7 @@ void FileSelector::updateLocation()
|
||||
fileItem = *it;
|
||||
|
||||
// Indentation
|
||||
base::string buf;
|
||||
std::string buf;
|
||||
for (int c=0; c<level; ++c)
|
||||
buf += " ";
|
||||
|
||||
@ -565,7 +565,7 @@ void FileSelector::addInNavigationHistory(IFileItem* folder)
|
||||
|
||||
void FileSelector::selectFileTypeFromFileName()
|
||||
{
|
||||
base::string ext = base::get_file_extension(m_fileName->getText());
|
||||
std::string ext = base::get_file_extension(m_fileName->getText());
|
||||
|
||||
if (!ext.empty()) {
|
||||
ext = base::string_to_lower(ext);
|
||||
@ -625,7 +625,7 @@ void FileSelector::onLocationCloseListBox()
|
||||
dynamic_cast<CustomFolderNameItem*>(m_location->getSelectedItem());
|
||||
|
||||
if (comboFolderItem != NULL) {
|
||||
base::string path = comboFolderItem->getText();
|
||||
std::string path = comboFolderItem->getText();
|
||||
fileItem = FileSystemModule::instance()->getFileItemFromPath(path);
|
||||
}
|
||||
}
|
||||
@ -658,7 +658,7 @@ void FileSelector::onFileListFileSelected()
|
||||
IFileItem* fileitem = m_fileList->getSelectedFileItem();
|
||||
|
||||
if (!fileitem->isFolder()) {
|
||||
base::string filename = base::get_file_name(fileitem->getFileName());
|
||||
std::string filename = base::get_file_name(fileitem->getFileName());
|
||||
|
||||
m_fileName->setText(filename.c_str());
|
||||
m_fileName->selectText(0, -1);
|
||||
|
@ -20,10 +20,11 @@
|
||||
#define APP_UI_FILE_SELECTOR_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "base/string.h"
|
||||
#include "base/unique_ptr.h"
|
||||
#include "ui/window.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace ui {
|
||||
class Button;
|
||||
class ComboBox;
|
||||
@ -40,9 +41,9 @@ namespace app {
|
||||
FileSelector();
|
||||
|
||||
// Shows the dialog to select a file in the program.
|
||||
base::string show(const base::string& title,
|
||||
const base::string& initialPath,
|
||||
const base::string& showExtensions);
|
||||
std::string show(const std::string& title,
|
||||
const std::string& initialPath,
|
||||
const std::string& showExtensions);
|
||||
|
||||
private:
|
||||
void updateLocation();
|
||||
|
@ -38,7 +38,7 @@ namespace app {
|
||||
using namespace app::skin;
|
||||
using namespace ui;
|
||||
|
||||
PopupWindowPin::PopupWindowPin(const base::string& text, ClickBehavior clickBehavior)
|
||||
PopupWindowPin::PopupWindowPin(const std::string& text, ClickBehavior clickBehavior)
|
||||
: PopupWindow(text, clickBehavior)
|
||||
, m_pin("")
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ namespace app {
|
||||
|
||||
class PopupWindowPin : public ui::PopupWindow {
|
||||
public:
|
||||
PopupWindowPin(const base::string& text, ClickBehavior clickBehavior);
|
||||
PopupWindowPin(const std::string& text, ClickBehavior clickBehavior);
|
||||
|
||||
protected:
|
||||
virtual bool onProcessMessage(ui::Message* msg) OVERRIDE;
|
||||
|
@ -92,8 +92,8 @@ void UIContext::setActiveView(DocumentView* docView)
|
||||
app_refresh_screen();
|
||||
|
||||
// Change the main frame title.
|
||||
base::string defaultTitle = PACKAGE " v" VERSION;
|
||||
base::string title;
|
||||
std::string defaultTitle = PACKAGE " v" VERSION;
|
||||
std::string title;
|
||||
if (docView) {
|
||||
// Prepend the document's filename.
|
||||
title += base::get_file_name(docView->getDocument()->getFilename());
|
||||
|
@ -90,8 +90,8 @@ Widget* WidgetLoader::loadWidget(const char* fileName, const char* widgetId)
|
||||
return widget;
|
||||
}
|
||||
|
||||
Widget* WidgetLoader::loadWidgetFromXmlFile(const base::string& xmlFilename,
|
||||
const base::string& widgetId)
|
||||
Widget* WidgetLoader::loadWidgetFromXmlFile(const std::string& xmlFilename,
|
||||
const std::string& widgetId)
|
||||
{
|
||||
Widget* widget = NULL;
|
||||
m_tooltipManager = NULL;
|
||||
|
@ -21,9 +21,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "app/widget_type_mismatch.h"
|
||||
#include "base/string.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
class TiXmlElement;
|
||||
|
||||
@ -70,11 +70,11 @@ namespace app {
|
||||
}
|
||||
|
||||
private:
|
||||
ui::Widget* loadWidgetFromXmlFile(const base::string& xmlFilename,
|
||||
const base::string& widgetId);
|
||||
ui::Widget* loadWidgetFromXmlFile(const std::string& xmlFilename,
|
||||
const std::string& widgetId);
|
||||
ui::Widget* convertXmlElementToWidget(const TiXmlElement* elem, ui::Widget* root);
|
||||
|
||||
typedef std::map<base::string, IWidgetTypeCreator*> TypeCreatorsMap;
|
||||
typedef std::map<std::string, IWidgetTypeCreator*> TypeCreatorsMap;
|
||||
|
||||
TypeCreatorsMap m_typeCreators;
|
||||
ui::TooltipManager* m_tooltipManager;
|
||||
|
@ -31,7 +31,7 @@ namespace app {
|
||||
|
||||
using namespace base;
|
||||
|
||||
XmlDocumentRef open_xml(const string& filename)
|
||||
XmlDocumentRef open_xml(const std::string& filename)
|
||||
{
|
||||
FileHandle file(open_file(filename, "rb"));
|
||||
if (!file)
|
||||
|
@ -22,15 +22,16 @@
|
||||
|
||||
#include "base/exception.h"
|
||||
#include "base/shared_ptr.h"
|
||||
#include "base/string.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace app {
|
||||
|
||||
typedef SharedPtr<TiXmlDocument> XmlDocumentRef;
|
||||
|
||||
XmlDocumentRef open_xml(const base::string& filename);
|
||||
XmlDocumentRef open_xml(const std::string& filename);
|
||||
|
||||
} // namespace app
|
||||
|
||||
|
@ -16,19 +16,19 @@
|
||||
|
||||
namespace base {
|
||||
|
||||
template<> int convert_to(const string& from)
|
||||
template<> int convert_to(const std::string& from)
|
||||
{
|
||||
return std::strtol(from.c_str(), NULL, 10);
|
||||
}
|
||||
|
||||
template<> string convert_to(const int& from)
|
||||
template<> std::string convert_to(const int& from)
|
||||
{
|
||||
char buf[32];
|
||||
std::sprintf(buf, "%d", from);
|
||||
return buf;
|
||||
}
|
||||
|
||||
template<> Sha1 convert_to(const string& from)
|
||||
template<> Sha1 convert_to(const std::string& from)
|
||||
{
|
||||
std::vector<uint8_t> digest(Sha1::HashSize);
|
||||
|
||||
@ -42,10 +42,10 @@ template<> Sha1 convert_to(const string& from)
|
||||
return Sha1(digest);
|
||||
}
|
||||
|
||||
template<> string convert_to(const Sha1& from)
|
||||
template<> std::string convert_to(const Sha1& from)
|
||||
{
|
||||
char buf[3];
|
||||
string res;
|
||||
std::string res;
|
||||
res.reserve(2*Sha1::HashSize);
|
||||
|
||||
for(int c=0; c<Sha1::HashSize; ++c) {
|
||||
@ -56,14 +56,14 @@ template<> string convert_to(const Sha1& from)
|
||||
return res;
|
||||
}
|
||||
|
||||
template<> Version convert_to(const string& from)
|
||||
template<> Version convert_to(const std::string& from)
|
||||
{
|
||||
Version result;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
while (j != string::npos) {
|
||||
while (j != std::string::npos) {
|
||||
j = from.find('.', i);
|
||||
string digitString = from.substr(i, j - i);
|
||||
std::string digitString = from.substr(i, j - i);
|
||||
int digit = convert_to<int>(digitString);
|
||||
result.addDigit(digit);
|
||||
i = j+1;
|
||||
@ -71,13 +71,13 @@ template<> Version convert_to(const string& from)
|
||||
return result;
|
||||
}
|
||||
|
||||
template<> string convert_to(const Version& from)
|
||||
template<> std::string convert_to(const Version& from)
|
||||
{
|
||||
string result;
|
||||
std::string result;
|
||||
result.reserve(3*from.size());
|
||||
|
||||
for (size_t i=0; i<from.size(); ++i) {
|
||||
result += convert_to<string>(from[i]);
|
||||
result += convert_to<std::string>(from[i]);
|
||||
if (i < from.size()-1)
|
||||
result += ".";
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define BASE_CONVERT_TO_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "base/string.h"
|
||||
#include <string>
|
||||
|
||||
namespace base {
|
||||
|
||||
@ -25,14 +25,14 @@ namespace base {
|
||||
// TODO Use a static_assert(false)
|
||||
}
|
||||
|
||||
template<> int convert_to(const base::string& from);
|
||||
template<> base::string convert_to(const int& from);
|
||||
template<> int convert_to(const std::string& from);
|
||||
template<> std::string convert_to(const int& from);
|
||||
|
||||
template<> Sha1 convert_to(const base::string& from);
|
||||
template<> base::string convert_to(const Sha1& from);
|
||||
template<> Sha1 convert_to(const std::string& from);
|
||||
template<> std::string convert_to(const Sha1& from);
|
||||
|
||||
template<> Version convert_to(const base::string& from);
|
||||
template<> base::string convert_to(const Version& from);
|
||||
template<> Version convert_to(const std::string& from);
|
||||
template<> std::string convert_to(const Version& from);
|
||||
|
||||
}
|
||||
|
||||
|
@ -9,18 +9,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "base/shared_ptr.h"
|
||||
#include "base/string.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
namespace base {
|
||||
|
||||
typedef SharedPtr<FILE> FileHandle;
|
||||
|
||||
FILE* open_file_raw(const string& filename, const string& mode);
|
||||
FileHandle open_file(const string& filename, const string& mode);
|
||||
FileHandle open_file_with_exception(const string& filename, const string& mode);
|
||||
int open_file_descriptor_with_exception(const string& filename, const string& mode);
|
||||
FILE* open_file_raw(const std::string& filename, const std::string& mode);
|
||||
FileHandle open_file(const std::string& filename, const std::string& mode);
|
||||
FileHandle open_file_with_exception(const std::string& filename, const std::string& mode);
|
||||
int open_file_descriptor_with_exception(const std::string& filename, const std::string& mode);
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,23 +8,23 @@
|
||||
#define BASE_FS_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "base/string.h"
|
||||
#include <string>
|
||||
|
||||
namespace base {
|
||||
|
||||
bool is_file(const string& path);
|
||||
bool is_directory(const string& path);
|
||||
bool is_file(const std::string& path);
|
||||
bool is_directory(const std::string& path);
|
||||
|
||||
void delete_file(const string& path);
|
||||
void delete_file(const std::string& path);
|
||||
|
||||
bool has_readonly_attr(const string& path);
|
||||
void remove_readonly_attr(const string& path);
|
||||
bool has_readonly_attr(const std::string& path);
|
||||
void remove_readonly_attr(const std::string& path);
|
||||
|
||||
void make_directory(const string& path);
|
||||
void remove_directory(const string& path);
|
||||
void make_directory(const std::string& path);
|
||||
void remove_directory(const std::string& path);
|
||||
|
||||
string get_app_path();
|
||||
string get_temp_path();
|
||||
std::string get_app_path();
|
||||
std::string get_temp_path();
|
||||
|
||||
}
|
||||
|
||||
|
@ -21,19 +21,19 @@
|
||||
|
||||
namespace base {
|
||||
|
||||
bool is_file(const string& path)
|
||||
bool is_file(const std::string& path)
|
||||
{
|
||||
struct stat sts;
|
||||
return (stat(path.c_str(), &sts) == 0 && S_ISREG(sts.st_mode)) ? true: false;
|
||||
}
|
||||
|
||||
bool is_directory(const string& path)
|
||||
bool is_directory(const std::string& path)
|
||||
{
|
||||
struct stat sts;
|
||||
return (stat(path.c_str(), &sts) == 0 && S_ISDIR(sts.st_mode)) ? true: false;
|
||||
}
|
||||
|
||||
void make_directory(const string& path)
|
||||
void make_directory(const std::string& path)
|
||||
{
|
||||
int result = mkdir(path.c_str(), 0777);
|
||||
if (result < 0) {
|
||||
@ -42,7 +42,7 @@ void make_directory(const string& path)
|
||||
}
|
||||
}
|
||||
|
||||
void delete_file(const string& path)
|
||||
void delete_file(const std::string& path)
|
||||
{
|
||||
int result = unlink(path.c_str());
|
||||
if (result != 0)
|
||||
@ -50,13 +50,13 @@ void delete_file(const string& path)
|
||||
throw std::runtime_error("Error deleting file");
|
||||
}
|
||||
|
||||
bool has_readonly_attr(const string& path)
|
||||
bool has_readonly_attr(const std::string& path)
|
||||
{
|
||||
struct stat sts;
|
||||
return (stat(path.c_str(), &sts) == 0 && ((sts.st_mode & S_IWUSR) == 0));
|
||||
}
|
||||
|
||||
void remove_readonly_attr(const string& path)
|
||||
void remove_readonly_attr(const std::string& path)
|
||||
{
|
||||
struct stat sts;
|
||||
int result = stat(path.c_str(), &sts);
|
||||
@ -68,7 +68,7 @@ void remove_readonly_attr(const string& path)
|
||||
}
|
||||
}
|
||||
|
||||
void remove_directory(const string& path)
|
||||
void remove_directory(const std::string& path)
|
||||
{
|
||||
int result = rmdir(path.c_str());
|
||||
if (result != 0) {
|
||||
@ -77,7 +77,7 @@ void remove_directory(const string& path)
|
||||
}
|
||||
}
|
||||
|
||||
string get_app_path()
|
||||
std::string get_app_path()
|
||||
{
|
||||
std::vector<char> path(MAXPATHLEN);
|
||||
|
||||
@ -97,7 +97,7 @@ string get_app_path()
|
||||
return std::string();
|
||||
}
|
||||
|
||||
string get_temp_path()
|
||||
std::string get_temp_path()
|
||||
{
|
||||
char* tmpdir = getenv("TMPDIR");
|
||||
if (tmpdir)
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace base {
|
||||
|
||||
bool is_file(const string& path)
|
||||
bool is_file(const std::string& path)
|
||||
{
|
||||
DWORD attr = ::GetFileAttributes(from_utf8(path).c_str());
|
||||
|
||||
@ -22,7 +22,7 @@ bool is_file(const string& path)
|
||||
!(attr & FILE_ATTRIBUTE_DIRECTORY));
|
||||
}
|
||||
|
||||
bool is_directory(const string& path)
|
||||
bool is_directory(const std::string& path)
|
||||
{
|
||||
DWORD attr = ::GetFileAttributes(from_utf8(path).c_str());
|
||||
|
||||
@ -30,21 +30,21 @@ bool is_directory(const string& path)
|
||||
((attr & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY));
|
||||
}
|
||||
|
||||
void delete_file(const string& path)
|
||||
void delete_file(const std::string& path)
|
||||
{
|
||||
BOOL result = ::DeleteFile(from_utf8(path).c_str());
|
||||
if (result == 0)
|
||||
throw Win32Exception("Error deleting file");
|
||||
}
|
||||
|
||||
bool has_readonly_attr(const string& path)
|
||||
bool has_readonly_attr(const std::string& path)
|
||||
{
|
||||
std::wstring fn = from_utf8(path);
|
||||
DWORD attr = ::GetFileAttributes(fn.c_str());
|
||||
return ((attr & FILE_ATTRIBUTE_READONLY) == FILE_ATTRIBUTE_READONLY);
|
||||
}
|
||||
|
||||
void remove_readonly_attr(const string& path)
|
||||
void remove_readonly_attr(const std::string& path)
|
||||
{
|
||||
std::wstring fn = from_utf8(path);
|
||||
DWORD attr = ::GetFileAttributes(fn.c_str());
|
||||
@ -52,7 +52,7 @@ void remove_readonly_attr(const string& path)
|
||||
::SetFileAttributes(fn.c_str(), attr & ~FILE_ATTRIBUTE_READONLY);
|
||||
}
|
||||
|
||||
void make_directory(const string& path)
|
||||
void make_directory(const std::string& path)
|
||||
{
|
||||
BOOL result = ::CreateDirectory(from_utf8(path).c_str(), NULL);
|
||||
if (result == 0)
|
||||
@ -60,14 +60,14 @@ void make_directory(const string& path)
|
||||
}
|
||||
|
||||
|
||||
void remove_directory(const string& path)
|
||||
void remove_directory(const std::string& path)
|
||||
{
|
||||
BOOL result = ::RemoveDirectory(from_utf8(path).c_str());
|
||||
if (result == 0)
|
||||
throw Win32Exception("Error removing directory");
|
||||
}
|
||||
|
||||
string get_app_path()
|
||||
std::string get_app_path()
|
||||
{
|
||||
TCHAR buffer[MAX_PATH+1];
|
||||
if (::GetModuleFileName(NULL, buffer, sizeof(buffer)/sizeof(TCHAR)))
|
||||
@ -76,7 +76,7 @@ string get_app_path()
|
||||
return "";
|
||||
}
|
||||
|
||||
string get_temp_path()
|
||||
std::string get_temp_path()
|
||||
{
|
||||
TCHAR buffer[MAX_PATH+1];
|
||||
DWORD result = GetTempPath(sizeof(buffer)/sizeof(TCHAR), buffer);
|
||||
|
@ -9,26 +9,29 @@
|
||||
#endif
|
||||
|
||||
#include "base/path.h"
|
||||
|
||||
#include "base/string.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
namespace base {
|
||||
|
||||
#ifdef WIN32
|
||||
const string::value_type path_separator = '\\';
|
||||
const std::string::value_type path_separator = '\\';
|
||||
#else
|
||||
const string::value_type path_separator = '/';
|
||||
const std::string::value_type path_separator = '/';
|
||||
#endif
|
||||
|
||||
bool is_path_separator(string::value_type chr)
|
||||
bool is_path_separator(std::string::value_type chr)
|
||||
{
|
||||
return (chr == '\\' || chr == '/');
|
||||
}
|
||||
|
||||
string get_file_path(const string& filename)
|
||||
std::string get_file_path(const std::string& filename)
|
||||
{
|
||||
string::const_reverse_iterator rit;
|
||||
string res;
|
||||
std::string::const_reverse_iterator rit;
|
||||
std::string res;
|
||||
|
||||
for (rit=filename.rbegin(); rit!=filename.rend(); ++rit)
|
||||
if (is_path_separator(*rit))
|
||||
@ -36,32 +39,32 @@ string get_file_path(const string& filename)
|
||||
|
||||
if (rit != filename.rend()) {
|
||||
++rit;
|
||||
std::copy(filename.begin(), string::const_iterator(rit.base()),
|
||||
std::copy(filename.begin(), std::string::const_iterator(rit.base()),
|
||||
std::back_inserter(res));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
string get_file_name(const string& filename)
|
||||
std::string get_file_name(const std::string& filename)
|
||||
{
|
||||
string::const_reverse_iterator rit;
|
||||
string result;
|
||||
std::string::const_reverse_iterator rit;
|
||||
std::string result;
|
||||
|
||||
for (rit=filename.rbegin(); rit!=filename.rend(); ++rit)
|
||||
if (is_path_separator(*rit))
|
||||
break;
|
||||
|
||||
std::copy(string::const_iterator(rit.base()), filename.end(),
|
||||
std::copy(std::string::const_iterator(rit.base()), filename.end(),
|
||||
std::back_inserter(result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
string get_file_extension(const string& filename)
|
||||
std::string get_file_extension(const std::string& filename)
|
||||
{
|
||||
string::const_reverse_iterator rit;
|
||||
string result;
|
||||
std::string::const_reverse_iterator rit;
|
||||
std::string result;
|
||||
|
||||
// search for the first dot from the end of the string
|
||||
for (rit=filename.rbegin(); rit!=filename.rend(); ++rit) {
|
||||
@ -72,18 +75,18 @@ string get_file_extension(const string& filename)
|
||||
}
|
||||
|
||||
if (rit != filename.rend()) {
|
||||
std::copy(string::const_iterator(rit.base()), filename.end(),
|
||||
std::copy(std::string::const_iterator(rit.base()), filename.end(),
|
||||
std::back_inserter(result));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
string get_file_title(const string& filename)
|
||||
std::string get_file_title(const std::string& filename)
|
||||
{
|
||||
string::const_reverse_iterator rit;
|
||||
string::const_iterator last_dot = filename.end();
|
||||
string result;
|
||||
std::string::const_reverse_iterator rit;
|
||||
std::string::const_iterator last_dot = filename.end();
|
||||
std::string result;
|
||||
|
||||
for (rit=filename.rbegin(); rit!=filename.rend(); ++rit) {
|
||||
if (is_path_separator(*rit))
|
||||
@ -92,7 +95,7 @@ string get_file_title(const string& filename)
|
||||
last_dot = rit.base()-1;
|
||||
}
|
||||
|
||||
for (string::const_iterator it(rit.base()); it!=filename.end(); ++it) {
|
||||
for (std::string::const_iterator it(rit.base()); it!=filename.end(); ++it) {
|
||||
if (it == last_dot)
|
||||
break;
|
||||
else
|
||||
@ -102,9 +105,9 @@ string get_file_title(const string& filename)
|
||||
return result;
|
||||
}
|
||||
|
||||
string join_path(const string& path, const string& file)
|
||||
std::string join_path(const std::string& path, const std::string& file)
|
||||
{
|
||||
string result(path);
|
||||
std::string result(path);
|
||||
|
||||
// Add a separator at the end if it is necessay
|
||||
if (!result.empty() && !is_path_separator(*(result.end()-1)))
|
||||
@ -115,9 +118,9 @@ string join_path(const string& path, const string& file)
|
||||
return result;
|
||||
}
|
||||
|
||||
string remove_path_separator(const string& path)
|
||||
std::string remove_path_separator(const std::string& path)
|
||||
{
|
||||
string result(path);
|
||||
std::string result(path);
|
||||
|
||||
// Erase all trailing separators
|
||||
while (!result.empty() && is_path_separator(*(result.end()-1)))
|
||||
@ -126,9 +129,9 @@ string remove_path_separator(const string& path)
|
||||
return result;
|
||||
}
|
||||
|
||||
string fix_path_separators(const string& filename)
|
||||
std::string fix_path_separators(const std::string& filename)
|
||||
{
|
||||
string result(filename);
|
||||
std::string result(filename);
|
||||
|
||||
// Replace any separator with the system path separator.
|
||||
std::replace_if(result.begin(), result.end(),
|
||||
@ -137,13 +140,13 @@ string fix_path_separators(const string& filename)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool has_file_extension(const string& filename, const string& csv_extensions)
|
||||
bool has_file_extension(const std::string& filename, const std::string& csv_extensions)
|
||||
{
|
||||
if (!filename.empty()) {
|
||||
string ext = string_to_lower(get_file_extension(filename));
|
||||
std::string ext = base::string_to_lower(get_file_extension(filename));
|
||||
|
||||
int extsz = ext.size();
|
||||
string::const_iterator p =
|
||||
std::string::const_iterator p =
|
||||
std::search(csv_extensions.begin(),
|
||||
csv_extensions.end(),
|
||||
ext.begin(), ext.end());
|
||||
|
@ -8,42 +8,42 @@
|
||||
#define BASE_PATH_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "base/string.h"
|
||||
#include <string>
|
||||
|
||||
namespace base {
|
||||
|
||||
// Default path separator (on Windows it is '\' and on Unix-like systems it is '/').
|
||||
extern const string::value_type path_separator;
|
||||
extern const std::string::value_type path_separator;
|
||||
|
||||
// Returns true if the given character is a valud path separator
|
||||
// (any of '\' or '/' characters).
|
||||
bool is_path_separator(string::value_type chr);
|
||||
bool is_path_separator(std::string::value_type chr);
|
||||
|
||||
// Returns only the path (without the last trailing slash).
|
||||
string get_file_path(const string& filename);
|
||||
std::string get_file_path(const std::string& filename);
|
||||
|
||||
// Returns the file name with its extension, removing the path.
|
||||
string get_file_name(const string& filename);
|
||||
std::string get_file_name(const std::string& filename);
|
||||
|
||||
// Returns the extension of the file name (without the dot).
|
||||
string get_file_extension(const string& filename);
|
||||
std::string get_file_extension(const std::string& filename);
|
||||
|
||||
// Returns the file name without path and without extension.
|
||||
string get_file_title(const string& filename);
|
||||
std::string get_file_title(const std::string& filename);
|
||||
|
||||
// Joins two paths or a path and a file name with a path-separator.
|
||||
string join_path(const string& path, const string& file);
|
||||
std::string join_path(const std::string& path, const std::string& file);
|
||||
|
||||
// Removes the trailing separator from the given path.
|
||||
string remove_path_separator(const string& path);
|
||||
std::string remove_path_separator(const std::string& path);
|
||||
|
||||
// Replaces all separators with the system separator.
|
||||
string fix_path_separators(const string& filename);
|
||||
std::string fix_path_separators(const std::string& filename);
|
||||
|
||||
// Returns true if the filename contains one of the specified
|
||||
// extensions. The cvs_extensions parameter must be a set of
|
||||
// possible extensions separated by comma.
|
||||
bool has_file_extension(const string& filename, const string& csv_extensions);
|
||||
bool has_file_extension(const std::string& filename, const std::string& csv_extensions);
|
||||
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ TEST(Path, GetFileTitle)
|
||||
|
||||
TEST(Path, JoinPath)
|
||||
{
|
||||
base::string sep;
|
||||
std::string sep;
|
||||
sep.push_back(path_separator);
|
||||
|
||||
EXPECT_EQ("", join_path("", ""));
|
||||
|
@ -15,14 +15,14 @@
|
||||
namespace {
|
||||
|
||||
struct is_separator {
|
||||
const base::string* separators;
|
||||
const std::string* separators;
|
||||
|
||||
is_separator(const base::string* seps) : separators(seps) {
|
||||
is_separator(const std::string* seps) : separators(seps) {
|
||||
}
|
||||
|
||||
bool operator()(base::string::value_type chr)
|
||||
bool operator()(std::string::value_type chr)
|
||||
{
|
||||
for (base::string::const_iterator
|
||||
for (std::string::const_iterator
|
||||
it = separators->begin(),
|
||||
end = separators->end(); it != end; ++it) {
|
||||
if (chr == *it)
|
||||
@ -34,9 +34,9 @@ namespace {
|
||||
|
||||
}
|
||||
|
||||
void base::split_string(const base::string& string,
|
||||
std::vector<base::string>& parts,
|
||||
const base::string& separators)
|
||||
void base::split_string(const std::string& string,
|
||||
std::vector<std::string>& parts,
|
||||
const std::string& separators)
|
||||
{
|
||||
size_t elements = 1 + std::count_if(string.begin(), string.end(), is_separator(&separators));
|
||||
parts.reserve(elements);
|
||||
@ -44,7 +44,7 @@ void base::split_string(const base::string& string,
|
||||
size_t beg = 0, end;
|
||||
while (true) {
|
||||
end = string.find_first_of(separators, beg);
|
||||
if (end != base::string::npos) {
|
||||
if (end != std::string::npos) {
|
||||
parts.push_back(string.substr(beg, end - beg));
|
||||
beg = end+1;
|
||||
}
|
||||
|
@ -8,14 +8,14 @@
|
||||
#define BASE_SPLIT_STRING_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "base/string.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace base {
|
||||
|
||||
void split_string(const base::string& string,
|
||||
std::vector<base::string>& parts,
|
||||
const base::string& separators);
|
||||
void split_string(const std::string& string,
|
||||
std::vector<std::string>& parts,
|
||||
const std::string& separators);
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
TEST(SplitString, Empty)
|
||||
{
|
||||
std::vector<base::string> result;
|
||||
std::vector<std::string> result;
|
||||
base::split_string("", result, ",");
|
||||
ASSERT_EQ(1, result.size());
|
||||
EXPECT_EQ("", result[0]);
|
||||
@ -21,7 +21,7 @@ TEST(SplitString, Empty)
|
||||
|
||||
TEST(SplitString, NoSeparator)
|
||||
{
|
||||
std::vector<base::string> result;
|
||||
std::vector<std::string> result;
|
||||
base::split_string("Hello,World", result, "");
|
||||
ASSERT_EQ(1, result.size());
|
||||
EXPECT_EQ("Hello,World", result[0]);
|
||||
@ -29,7 +29,7 @@ TEST(SplitString, NoSeparator)
|
||||
|
||||
TEST(SplitString, OneSeparator)
|
||||
{
|
||||
std::vector<base::string> result;
|
||||
std::vector<std::string> result;
|
||||
base::split_string("Hello,World", result, ",");
|
||||
ASSERT_EQ(2, result.size());
|
||||
EXPECT_EQ("Hello", result[0]);
|
||||
@ -38,7 +38,7 @@ TEST(SplitString, OneSeparator)
|
||||
|
||||
TEST(SplitString, MultipleSeparators)
|
||||
{
|
||||
std::vector<base::string> result;
|
||||
std::vector<std::string> result;
|
||||
base::split_string("Hello,World", result, ",r");
|
||||
ASSERT_EQ(3, result.size());
|
||||
EXPECT_EQ("Hello", result[0]);
|
||||
|
@ -19,21 +19,21 @@
|
||||
|
||||
namespace base {
|
||||
|
||||
string string_to_lower(const string& original)
|
||||
std::string string_to_lower(const std::string& original)
|
||||
{
|
||||
string result(original);
|
||||
std::string result(original);
|
||||
|
||||
for (string::iterator it=result.begin(); it!=result.end(); ++it)
|
||||
for (std::string::iterator it=result.begin(); it!=result.end(); ++it)
|
||||
*it = std::tolower(*it);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
string string_to_upper(const string& original)
|
||||
std::string string_to_upper(const std::string& original)
|
||||
{
|
||||
string result(original);
|
||||
std::string result(original);
|
||||
|
||||
for (string::iterator it=result.begin(); it!=result.end(); ++it)
|
||||
for (std::string::iterator it=result.begin(); it!=result.end(); ++it)
|
||||
*it = std::toupper(*it);
|
||||
|
||||
return result;
|
||||
@ -41,7 +41,7 @@ string string_to_upper(const string& original)
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
string to_utf8(const std::wstring& src)
|
||||
std::string to_utf8(const std::wstring& src)
|
||||
{
|
||||
int required_size =
|
||||
::WideCharToMultiByte(CP_UTF8, 0,
|
||||
@ -49,7 +49,7 @@ string to_utf8(const std::wstring& src)
|
||||
NULL, 0, NULL, NULL);
|
||||
|
||||
if (required_size == 0)
|
||||
return string();
|
||||
return std::string();
|
||||
|
||||
std::vector<char> buf(++required_size);
|
||||
|
||||
@ -58,10 +58,10 @@ string to_utf8(const std::wstring& src)
|
||||
&buf[0], required_size,
|
||||
NULL, NULL);
|
||||
|
||||
return base::string(&buf[0]);
|
||||
return std::string(&buf[0]);
|
||||
}
|
||||
|
||||
std::wstring from_utf8(const string& src)
|
||||
std::wstring from_utf8(const std::string& src)
|
||||
{
|
||||
int required_size =
|
||||
MultiByteToWideChar(CP_UTF8, 0,
|
||||
@ -83,7 +83,7 @@ std::wstring from_utf8(const string& src)
|
||||
#else
|
||||
|
||||
// Based on Allegro Unicode code (allegro/src/unicode.c)
|
||||
static size_t insert_utf8_char(string* result, wchar_t chr)
|
||||
static size_t insert_utf8_char(std::string* result, wchar_t chr)
|
||||
{
|
||||
int size, bits, b, i;
|
||||
|
||||
@ -122,7 +122,7 @@ static size_t insert_utf8_char(string* result, wchar_t chr)
|
||||
return size;
|
||||
}
|
||||
|
||||
string to_utf8(const std::wstring& src)
|
||||
std::string to_utf8(const std::wstring& src)
|
||||
{
|
||||
std::wstring::const_iterator it, begin = src.begin();
|
||||
std::wstring::const_iterator end = src.end();
|
||||
@ -135,14 +135,14 @@ string to_utf8(const std::wstring& src)
|
||||
if (!required_size)
|
||||
return "";
|
||||
|
||||
string result;
|
||||
std::string result;
|
||||
result.reserve(++required_size);
|
||||
for (it = begin; it != end; ++it)
|
||||
insert_utf8_char(&result, *it);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::wstring from_utf8(const string& src)
|
||||
std::wstring from_utf8(const std::string& src)
|
||||
{
|
||||
int required_size = utf8_length(src);
|
||||
std::vector<wchar_t> buf(++required_size);
|
||||
@ -163,7 +163,7 @@ std::wstring from_utf8(const string& src)
|
||||
|
||||
#endif
|
||||
|
||||
int utf8_length(const string& utf8string)
|
||||
int utf8_length(const std::string& utf8string)
|
||||
{
|
||||
utf8_const_iterator it(utf8string.begin());
|
||||
utf8_const_iterator end(utf8string.end());
|
||||
|
@ -13,20 +13,18 @@
|
||||
|
||||
namespace base {
|
||||
|
||||
typedef std::string string;
|
||||
std::string string_to_lower(const std::string& original);
|
||||
std::string string_to_upper(const std::string& original);
|
||||
|
||||
string string_to_lower(const string& original);
|
||||
string string_to_upper(const string& original);
|
||||
std::string to_utf8(const std::wstring& widestring);
|
||||
std::wstring from_utf8(const std::string& utf8string);
|
||||
|
||||
string to_utf8(const std::wstring& widestring);
|
||||
std::wstring from_utf8(const string& utf8string);
|
||||
|
||||
int utf8_length(const string& utf8string);
|
||||
int utf8_length(const std::string& utf8string);
|
||||
|
||||
template<typename SubIterator>
|
||||
class utf8_iteratorT : public std::iterator<std::forward_iterator_tag,
|
||||
string::value_type,
|
||||
string::difference_type,
|
||||
std::string::value_type,
|
||||
std::string::difference_type,
|
||||
typename SubIterator::pointer,
|
||||
typename SubIterator::reference> {
|
||||
public:
|
||||
@ -118,23 +116,23 @@ namespace base {
|
||||
SubIterator m_internal;
|
||||
};
|
||||
|
||||
class utf8_iterator : public utf8_iteratorT<string::iterator> {
|
||||
class utf8_iterator : public utf8_iteratorT<std::string::iterator> {
|
||||
public:
|
||||
utf8_iterator(const utf8_iteratorT<string::iterator>& it)
|
||||
: utf8_iteratorT<string::iterator>(it) {
|
||||
utf8_iterator(const utf8_iteratorT<std::string::iterator>& it)
|
||||
: utf8_iteratorT<std::string::iterator>(it) {
|
||||
}
|
||||
explicit utf8_iterator(const string::iterator& it)
|
||||
: utf8_iteratorT<string::iterator>(it) {
|
||||
explicit utf8_iterator(const std::string::iterator& it)
|
||||
: utf8_iteratorT<std::string::iterator>(it) {
|
||||
}
|
||||
};
|
||||
|
||||
class utf8_const_iterator : public utf8_iteratorT<string::const_iterator> {
|
||||
class utf8_const_iterator : public utf8_iteratorT<std::string::const_iterator> {
|
||||
public:
|
||||
utf8_const_iterator(const utf8_iteratorT<string::const_iterator>& it)
|
||||
: utf8_iteratorT<string::const_iterator>(it) {
|
||||
utf8_const_iterator(const utf8_iteratorT<std::string::const_iterator>& it)
|
||||
: utf8_iteratorT<std::string::const_iterator>(it) {
|
||||
}
|
||||
explicit utf8_const_iterator(const string::const_iterator& it)
|
||||
: utf8_iteratorT<string::const_iterator>(it) {
|
||||
explicit utf8_const_iterator(const std::string::const_iterator& it)
|
||||
: utf8_iteratorT<std::string::const_iterator>(it) {
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -30,7 +30,7 @@ TEST(String, Utf8Conversion)
|
||||
|
||||
TEST(String, Utf8Iterator)
|
||||
{
|
||||
string a = "Hello";
|
||||
std::string a = "Hello";
|
||||
int value = std::count_if(utf8_iterator(a.begin()),
|
||||
utf8_iterator(a.end()), all);
|
||||
ASSERT_EQ(5, value);
|
||||
@ -40,7 +40,7 @@ TEST(String, Utf8Iterator)
|
||||
ASSERT_EQ('l', *(utf8_iterator(a.begin())+3));
|
||||
ASSERT_EQ('o', *(utf8_iterator(a.begin())+4));
|
||||
|
||||
string b = "Copyright \xC2\xA9";
|
||||
std::string b = "Copyright \xC2\xA9";
|
||||
value = std::count_if(utf8_iterator(b.begin()),
|
||||
utf8_iterator(b.end()), all);
|
||||
ASSERT_EQ(11, value);
|
||||
@ -49,7 +49,7 @@ TEST(String, Utf8Iterator)
|
||||
ASSERT_EQ(0xA9, *(utf8_iterator(b.begin())+10));
|
||||
ASSERT_TRUE((utf8_iterator(b.begin())+11) == utf8_iterator(b.end()));
|
||||
|
||||
string c = "\xf0\x90\x8d\x86\xe6\x97\xa5\xd1\x88";
|
||||
std::string c = "\xf0\x90\x8d\x86\xe6\x97\xa5\xd1\x88";
|
||||
value = std::count_if(utf8_iterator(c.begin()),
|
||||
utf8_iterator(c.end()), all);
|
||||
ASSERT_EQ(3, value);
|
||||
@ -58,7 +58,7 @@ TEST(String, Utf8Iterator)
|
||||
ASSERT_EQ(0x448, *(utf8_iterator(c.begin())+2));
|
||||
ASSERT_TRUE((utf8_iterator(c.begin())+3) == utf8_iterator(c.end()));
|
||||
|
||||
string d = "\xf0\xa4\xad\xa2";
|
||||
std::string d = "\xf0\xa4\xad\xa2";
|
||||
value = std::count_if(utf8_iterator(d.begin()),
|
||||
utf8_iterator(d.end()), all);
|
||||
ASSERT_EQ(1, value);
|
||||
|
@ -22,11 +22,11 @@ TempDir::TempDir()
|
||||
{
|
||||
}
|
||||
|
||||
TempDir::TempDir(const string& appName)
|
||||
TempDir::TempDir(const std::string& appName)
|
||||
{
|
||||
for (int i=(std::rand()%0xffff); ; ++i) {
|
||||
m_path = join_path(get_temp_path(),
|
||||
appName + convert_to<string>(i));
|
||||
appName + convert_to<std::string>(i));
|
||||
|
||||
if (!is_directory(m_path)) {
|
||||
make_directory(m_path);
|
||||
@ -53,7 +53,7 @@ void TempDir::remove()
|
||||
}
|
||||
}
|
||||
|
||||
void TempDir::attach(const string& path)
|
||||
void TempDir::attach(const std::string& path)
|
||||
{
|
||||
remove();
|
||||
|
||||
|
@ -8,22 +8,22 @@
|
||||
#define BASE_TEMP_DIR_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "base/string.h"
|
||||
#include <string>
|
||||
|
||||
namespace base {
|
||||
|
||||
class TempDir {
|
||||
public:
|
||||
TempDir();
|
||||
TempDir(const string& appName);
|
||||
TempDir(const std::string& appName);
|
||||
~TempDir();
|
||||
|
||||
void remove();
|
||||
void attach(const string& path);
|
||||
const string& path() const { return m_path; }
|
||||
void attach(const std::string& path);
|
||||
const std::string& path() const { return m_path; }
|
||||
|
||||
private:
|
||||
string m_path;
|
||||
std::string m_path;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "base/trim_string.h"
|
||||
#include <cctype>
|
||||
|
||||
void base::trim_string(const base::string& input, base::string& output)
|
||||
void base::trim_string(const std::string& input, std::string& output)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
@ -8,11 +8,11 @@
|
||||
#define BASE_TRIM_STRING_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "base/string.h"
|
||||
#include <string>
|
||||
|
||||
namespace base {
|
||||
|
||||
void trim_string(const base::string& input, base::string& output);
|
||||
void trim_string(const std::string& input, std::string& output);
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ using namespace base;
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Version& ver)
|
||||
{
|
||||
return os << convert_to<string>(ver);
|
||||
return os << convert_to<std::string>(ver);
|
||||
}
|
||||
|
||||
TEST(Version, Ctor)
|
||||
@ -50,21 +50,21 @@ TEST(Version, Ctor)
|
||||
|
||||
TEST(Version, StringToVersion)
|
||||
{
|
||||
EXPECT_EQ(Version(), convert_to<Version>(string("")));
|
||||
EXPECT_EQ(Version(1), convert_to<Version>(string("1")));
|
||||
EXPECT_EQ(Version(1, 2), convert_to<Version>(string("1.2")));
|
||||
EXPECT_EQ(Version(1, 2, 3), convert_to<Version>(string("1.2.3")));
|
||||
EXPECT_EQ(Version(1, 2, 3, 4), convert_to<Version>(string("1.2.3.4")));
|
||||
EXPECT_EQ(Version(), convert_to<Version>(std::string("")));
|
||||
EXPECT_EQ(Version(1), convert_to<Version>(std::string("1")));
|
||||
EXPECT_EQ(Version(1, 2), convert_to<Version>(std::string("1.2")));
|
||||
EXPECT_EQ(Version(1, 2, 3), convert_to<Version>(std::string("1.2.3")));
|
||||
EXPECT_EQ(Version(1, 2, 3, 4), convert_to<Version>(std::string("1.2.3.4")));
|
||||
}
|
||||
|
||||
TEST(Version, VersionToString)
|
||||
{
|
||||
EXPECT_EQ("", convert_to<string>(Version()));
|
||||
EXPECT_EQ("0", convert_to<string>(Version(0)));
|
||||
EXPECT_EQ("1", convert_to<string>(Version(1)));
|
||||
EXPECT_EQ("1.0", convert_to<string>(Version(1, 0)));
|
||||
EXPECT_EQ("0.0", convert_to<string>(Version(0, 0)));
|
||||
EXPECT_EQ("1.0.2", convert_to<string>(Version(1, 0, 2)));
|
||||
EXPECT_EQ("", convert_to<std::string>(Version()));
|
||||
EXPECT_EQ("0", convert_to<std::string>(Version(0)));
|
||||
EXPECT_EQ("1", convert_to<std::string>(Version(1)));
|
||||
EXPECT_EQ("1.0", convert_to<std::string>(Version(1, 0)));
|
||||
EXPECT_EQ("0.0", convert_to<std::string>(Version(0, 0)));
|
||||
EXPECT_EQ("1.0.2", convert_to<std::string>(Version(1, 0, 2)));
|
||||
}
|
||||
|
||||
TEST(Version, Equal)
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "raster/palette.h"
|
||||
|
||||
#include "base/path.h"
|
||||
#include "base/string.h"
|
||||
#include "gfx/hsv.h"
|
||||
#include "gfx/rgb.h"
|
||||
#include "raster/conversion_alleg.h"
|
||||
@ -406,7 +407,7 @@ void Palette::sort(int from, int to, SortPalette* sort_palette, std::vector<int>
|
||||
|
||||
Palette* Palette::load(const char *filename)
|
||||
{
|
||||
base::string ext = base::string_to_lower(base::get_file_extension(filename));
|
||||
std::string ext = base::string_to_lower(base::get_file_extension(filename));
|
||||
Palette* pal = NULL;
|
||||
|
||||
if (ext == "png" ||
|
||||
@ -440,7 +441,7 @@ Palette* Palette::load(const char *filename)
|
||||
|
||||
bool Palette::save(const char *filename) const
|
||||
{
|
||||
base::string ext = base::string_to_lower(base::get_file_extension(filename));
|
||||
std::string ext = base::string_to_lower(base::get_file_extension(filename));
|
||||
bool success = false;
|
||||
|
||||
if (ext == "png" ||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
ButtonBase::ButtonBase(const base::string& text,
|
||||
ButtonBase::ButtonBase(const std::string& text,
|
||||
WidgetType type,
|
||||
WidgetType behaviorType,
|
||||
WidgetType drawType)
|
||||
@ -307,7 +307,7 @@ void ButtonBase::generateButtonSelectSignal()
|
||||
// Button class
|
||||
// ======================================================================
|
||||
|
||||
Button::Button(const base::string& text)
|
||||
Button::Button(const std::string& text)
|
||||
: ButtonBase(text, kButtonWidget, kButtonWidget, kButtonWidget)
|
||||
{
|
||||
setAlign(JI_CENTER | JI_MIDDLE);
|
||||
@ -317,7 +317,7 @@ Button::Button(const base::string& text)
|
||||
// CheckBox class
|
||||
// ======================================================================
|
||||
|
||||
CheckBox::CheckBox(const base::string& text, WidgetType drawType)
|
||||
CheckBox::CheckBox(const std::string& text, WidgetType drawType)
|
||||
: ButtonBase(text, kCheckWidget, kCheckWidget, drawType)
|
||||
{
|
||||
setAlign(JI_LEFT | JI_MIDDLE);
|
||||
@ -327,7 +327,7 @@ CheckBox::CheckBox(const base::string& text, WidgetType drawType)
|
||||
// RadioButton class
|
||||
// ======================================================================
|
||||
|
||||
RadioButton::RadioButton(const base::string& text, int radioGroup, WidgetType drawType)
|
||||
RadioButton::RadioButton(const std::string& text, int radioGroup, WidgetType drawType)
|
||||
: ButtonBase(text, kRadioWidget, kRadioWidget, drawType)
|
||||
{
|
||||
setAlign(JI_LEFT | JI_MIDDLE);
|
||||
|
@ -37,7 +37,7 @@ namespace ui {
|
||||
class ButtonBase : public Widget
|
||||
{
|
||||
public:
|
||||
ButtonBase(const base::string& text,
|
||||
ButtonBase(const std::string& text,
|
||||
WidgetType type,
|
||||
WidgetType behaviorType,
|
||||
WidgetType drawType);
|
||||
@ -81,21 +81,21 @@ namespace ui {
|
||||
class Button : public ButtonBase
|
||||
{
|
||||
public:
|
||||
Button(const base::string& text);
|
||||
Button(const std::string& text);
|
||||
};
|
||||
|
||||
// Check boxes
|
||||
class CheckBox : public ButtonBase
|
||||
{
|
||||
public:
|
||||
CheckBox(const base::string& text, WidgetType drawType = kCheckWidget);
|
||||
CheckBox(const std::string& text, WidgetType drawType = kCheckWidget);
|
||||
};
|
||||
|
||||
// Radio buttons
|
||||
class RadioButton : public ButtonBase
|
||||
{
|
||||
public:
|
||||
RadioButton(const base::string& text, int radioGroup, WidgetType drawType = kRadioWidget);
|
||||
RadioButton(const std::string& text, int radioGroup, WidgetType drawType = kRadioWidget);
|
||||
|
||||
int getRadioGroup() const;
|
||||
void setRadioGroup(int radioGroup);
|
||||
|
@ -163,7 +163,7 @@ int ComboBox::addItem(ListItem* item)
|
||||
return m_items.size()-1;
|
||||
}
|
||||
|
||||
int ComboBox::addItem(const base::string& text)
|
||||
int ComboBox::addItem(const std::string& text)
|
||||
{
|
||||
return addItem(new ListItem(text));
|
||||
}
|
||||
@ -178,7 +178,7 @@ void ComboBox::insertItem(int itemIndex, ListItem* item)
|
||||
setSelectedItemIndex(0);
|
||||
}
|
||||
|
||||
void ComboBox::insertItem(int itemIndex, const base::string& text)
|
||||
void ComboBox::insertItem(int itemIndex, const std::string& text)
|
||||
{
|
||||
insertItem(itemIndex, new ListItem(text));
|
||||
}
|
||||
@ -228,7 +228,7 @@ ListItem* ComboBox::getItem(int itemIndex)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const base::string& ComboBox::getItemText(int itemIndex) const
|
||||
const std::string& ComboBox::getItemText(int itemIndex) const
|
||||
{
|
||||
if (itemIndex >= 0 && (size_t)itemIndex < m_items.size()) {
|
||||
ListItem* item = m_items[itemIndex];
|
||||
@ -241,7 +241,7 @@ const base::string& ComboBox::getItemText(int itemIndex) const
|
||||
}
|
||||
}
|
||||
|
||||
void ComboBox::setItemText(int itemIndex, const base::string& text)
|
||||
void ComboBox::setItemText(int itemIndex, const std::string& text)
|
||||
{
|
||||
ASSERT(itemIndex >= 0 && (size_t)itemIndex < m_items.size());
|
||||
|
||||
@ -249,7 +249,7 @@ void ComboBox::setItemText(int itemIndex, const base::string& text)
|
||||
item->setText(text);
|
||||
}
|
||||
|
||||
int ComboBox::findItemIndex(const base::string& text)
|
||||
int ComboBox::findItemIndex(const std::string& text)
|
||||
{
|
||||
int itemIndex = 0;
|
||||
|
||||
|
@ -49,9 +49,9 @@ namespace ui {
|
||||
bool isCaseSensitive();
|
||||
|
||||
int addItem(ListItem* item);
|
||||
int addItem(const base::string& text);
|
||||
int addItem(const std::string& text);
|
||||
void insertItem(int itemIndex, ListItem* item);
|
||||
void insertItem(int itemIndex, const base::string& text);
|
||||
void insertItem(int itemIndex, const std::string& text);
|
||||
|
||||
// Removes the given item (you must delete it).
|
||||
void removeItem(ListItem* item);
|
||||
@ -64,9 +64,9 @@ namespace ui {
|
||||
int getItemCount() const;
|
||||
|
||||
ListItem* getItem(int itemIndex);
|
||||
const base::string& getItemText(int itemIndex) const;
|
||||
void setItemText(int itemIndex, const base::string& text);
|
||||
int findItemIndex(const base::string& text);
|
||||
const std::string& getItemText(int itemIndex) const;
|
||||
void setItemText(int itemIndex, const std::string& text);
|
||||
int findItemIndex(const std::string& text);
|
||||
|
||||
ListItem* getSelectedItem() const;
|
||||
void setSelectedItem(ListItem* item);
|
||||
|
@ -22,7 +22,7 @@ Component::~Component()
|
||||
{
|
||||
}
|
||||
|
||||
PropertyPtr Component::getProperty(const base::string& name)
|
||||
PropertyPtr Component::getProperty(const std::string& name)
|
||||
{
|
||||
Properties::iterator it = m_properties.find(name);
|
||||
if (it != m_properties.end())
|
||||
@ -36,13 +36,13 @@ void Component::setProperty(PropertyPtr property)
|
||||
m_properties[property->getName()] = property;
|
||||
}
|
||||
|
||||
bool Component::hasProperty(const base::string& name)
|
||||
bool Component::hasProperty(const std::string& name)
|
||||
{
|
||||
Properties::iterator it = m_properties.find(name);
|
||||
return it != m_properties.end();
|
||||
}
|
||||
|
||||
void Component::removeProperty(const base::string& name)
|
||||
void Component::removeProperty(const std::string& name)
|
||||
{
|
||||
Properties::iterator it = m_properties.find(name);
|
||||
if (it != m_properties.end())
|
||||
|
@ -8,12 +8,12 @@
|
||||
#define UI_COMPONENT_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "base/disable_copying.h"
|
||||
#include "base/string.h"
|
||||
#include "ui/property.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace ui {
|
||||
|
||||
// A component is a visual object, such as widgets or menus.
|
||||
@ -22,16 +22,16 @@ namespace ui {
|
||||
class Component
|
||||
{
|
||||
public:
|
||||
typedef std::map<base::string, PropertyPtr> Properties;
|
||||
typedef std::map<std::string, PropertyPtr> Properties;
|
||||
|
||||
Component();
|
||||
virtual ~Component();
|
||||
|
||||
PropertyPtr getProperty(const base::string& name);
|
||||
PropertyPtr getProperty(const std::string& name);
|
||||
void setProperty(PropertyPtr property);
|
||||
|
||||
bool hasProperty(const base::string& name);
|
||||
void removeProperty(const base::string& name);
|
||||
bool hasProperty(const std::string& name);
|
||||
void removeProperty(const std::string& name);
|
||||
|
||||
const Properties& getProperties() const;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
CustomLabel::CustomLabel(const base::string& text)
|
||||
CustomLabel::CustomLabel(const std::string& text)
|
||||
: Label(text)
|
||||
{
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace ui {
|
||||
class CustomLabel : public Label
|
||||
{
|
||||
public:
|
||||
CustomLabel(const base::string& text);
|
||||
CustomLabel(const std::string& text);
|
||||
|
||||
protected:
|
||||
bool onProcessMessage(Message* msg) OVERRIDE;
|
||||
|
@ -581,7 +581,7 @@ void Entry::executeCmd(EntryCmd::Type cmd, int unicodeChar, bool shift_pressed)
|
||||
const char* clipboard_str;
|
||||
|
||||
if ((clipboard_str = clipboard::get_text())) {
|
||||
base::string clipboard(clipboard_str);
|
||||
std::string clipboard(clipboard_str);
|
||||
|
||||
// delete the entire selection
|
||||
if (selbeg >= 0) {
|
||||
@ -629,7 +629,7 @@ void Entry::executeCmd(EntryCmd::Type cmd, int unicodeChar, bool shift_pressed)
|
||||
break;
|
||||
}
|
||||
|
||||
base::string newText = base::to_utf8(text);
|
||||
std::string newText = base::to_utf8(text);
|
||||
if (newText != getText()) {
|
||||
setText(newText.c_str());
|
||||
onEntryChange();
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
Label::Label(const base::string& text)
|
||||
Label::Label(const std::string& text)
|
||||
: Widget(kLabelWidget)
|
||||
{
|
||||
setAlign(JI_LEFT | JI_MIDDLE);
|
||||
|
@ -17,7 +17,7 @@ namespace ui {
|
||||
class Label : public Widget
|
||||
{
|
||||
public:
|
||||
Label(const base::string& text);
|
||||
Label(const std::string& text);
|
||||
|
||||
Color getTextColor() const;
|
||||
void setTextColor(Color color);
|
||||
|
@ -18,19 +18,19 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
LinkLabel::LinkLabel(const base::string& urlOrText)
|
||||
LinkLabel::LinkLabel(const std::string& urlOrText)
|
||||
: CustomLabel(urlOrText)
|
||||
, m_url(urlOrText)
|
||||
{
|
||||
}
|
||||
|
||||
LinkLabel::LinkLabel(const base::string& url, const base::string& text)
|
||||
LinkLabel::LinkLabel(const std::string& url, const std::string& text)
|
||||
: CustomLabel(text)
|
||||
, m_url(url)
|
||||
{
|
||||
}
|
||||
|
||||
void LinkLabel::setUrl(const base::string& url)
|
||||
void LinkLabel::setUrl(const std::string& url)
|
||||
{
|
||||
m_url = url;
|
||||
}
|
||||
|
@ -16,14 +16,13 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
class LinkLabel : public CustomLabel
|
||||
{
|
||||
class LinkLabel : public CustomLabel {
|
||||
public:
|
||||
LinkLabel(const base::string& urlOrText);
|
||||
LinkLabel(const base::string& url, const base::string& text);
|
||||
LinkLabel(const std::string& urlOrText);
|
||||
LinkLabel(const std::string& url, const std::string& text);
|
||||
|
||||
const base::string& getUrl() const { return m_url; }
|
||||
void setUrl(const base::string& url);
|
||||
const std::string& getUrl() const { return m_url; }
|
||||
void setUrl(const std::string& url);
|
||||
|
||||
Signal0<void> Click;
|
||||
|
||||
@ -31,7 +30,7 @@ namespace ui {
|
||||
bool onProcessMessage(Message* msg) OVERRIDE;
|
||||
void onPaint(PaintEvent& ev) OVERRIDE;
|
||||
|
||||
base::string m_url;
|
||||
std::string m_url;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
@ -20,7 +20,7 @@ namespace ui {
|
||||
|
||||
using namespace gfx;
|
||||
|
||||
ListItem::ListItem(const base::string& text)
|
||||
ListItem::ListItem(const std::string& text)
|
||||
: Widget(kListItemWidget)
|
||||
{
|
||||
setDoubleBuffered(true);
|
||||
|
@ -16,7 +16,7 @@ namespace ui {
|
||||
class ListItem : public Widget
|
||||
{
|
||||
public:
|
||||
ListItem(const base::string& text);
|
||||
ListItem(const std::string& text);
|
||||
|
||||
protected:
|
||||
void onPaint(PaintEvent& ev) OVERRIDE;
|
||||
|
@ -165,7 +165,7 @@ MenuBar::MenuBar()
|
||||
createBase();
|
||||
}
|
||||
|
||||
MenuItem::MenuItem(const base::string& text)
|
||||
MenuItem::MenuItem(const std::string& text)
|
||||
: Widget(kMenuItemWidget)
|
||||
{
|
||||
m_accel = NULL;
|
||||
|
@ -96,7 +96,7 @@ namespace ui {
|
||||
class MenuItem : public Widget
|
||||
{
|
||||
public:
|
||||
MenuItem(const base::string& text);
|
||||
MenuItem(const std::string& text);
|
||||
~MenuItem();
|
||||
|
||||
Menu* getSubmenu();
|
||||
|
@ -21,7 +21,7 @@ namespace ui {
|
||||
|
||||
using namespace gfx;
|
||||
|
||||
PopupWindow::PopupWindow(const base::string& text, ClickBehavior clickBehavior)
|
||||
PopupWindow::PopupWindow(const std::string& text, ClickBehavior clickBehavior)
|
||||
: Window(WithTitleBar, text)
|
||||
, m_clickBehavior(clickBehavior)
|
||||
, m_filtering(false)
|
||||
|
@ -22,7 +22,7 @@ namespace ui {
|
||||
kCloseOnClickOutsideHotRegion
|
||||
};
|
||||
|
||||
PopupWindow(const base::string& text, ClickBehavior clickBehavior);
|
||||
PopupWindow(const std::string& text, ClickBehavior clickBehavior);
|
||||
~PopupWindow();
|
||||
|
||||
void setHotRegion(const gfx::Region& region);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
Property::Property(const base::string& name)
|
||||
Property::Property(const std::string& name)
|
||||
: m_name(name)
|
||||
{
|
||||
}
|
||||
@ -17,7 +17,7 @@ Property::~Property()
|
||||
{
|
||||
}
|
||||
|
||||
base::string Property::getName() const
|
||||
std::string Property::getName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
@ -8,23 +8,23 @@
|
||||
#define UI_PROPERTY_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "base/string.h"
|
||||
#include "base/disable_copying.h"
|
||||
#include "base/shared_ptr.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace ui {
|
||||
|
||||
class Property
|
||||
{
|
||||
base::string m_name;
|
||||
|
||||
class Property {
|
||||
public:
|
||||
Property(const base::string& name);
|
||||
Property(const std::string& name);
|
||||
virtual ~Property();
|
||||
|
||||
base::string getName() const;
|
||||
std::string getName() const;
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
|
||||
DISABLE_COPYING(Property);
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace ui {
|
||||
|
||||
using namespace gfx;
|
||||
|
||||
Separator::Separator(const base::string& text, int align)
|
||||
Separator::Separator(const std::string& text, int align)
|
||||
: Widget(kSeparatorWidget)
|
||||
{
|
||||
setAlign(align);
|
||||
|
@ -16,7 +16,7 @@ namespace ui {
|
||||
class Separator : public Widget
|
||||
{
|
||||
public:
|
||||
Separator(const base::string& text, int align);
|
||||
Separator(const std::string& text, int align);
|
||||
|
||||
protected:
|
||||
void onPaint(PaintEvent& ev) OVERRIDE;
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
TextBox::TextBox(const base::string& text, int align)
|
||||
TextBox::TextBox(const std::string& text, int align)
|
||||
: Widget(kTextBoxWidget)
|
||||
{
|
||||
setFocusStop(true);
|
||||
|
@ -16,7 +16,7 @@ namespace ui {
|
||||
class TextBox : public Widget
|
||||
{
|
||||
public:
|
||||
TextBox(const base::string& text, int align);
|
||||
TextBox(const std::string& text, int align);
|
||||
|
||||
protected:
|
||||
bool onProcessMessage(Message* msg) OVERRIDE;
|
||||
|
@ -43,7 +43,7 @@ TooltipManager::~TooltipManager()
|
||||
manager->removeMessageFilterFor(this);
|
||||
}
|
||||
|
||||
void TooltipManager::addTooltipFor(Widget* widget, const base::string& text, int arrowAlign)
|
||||
void TooltipManager::addTooltipFor(Widget* widget, const std::string& text, int arrowAlign)
|
||||
{
|
||||
m_tips[widget] = TipInfo(text, arrowAlign);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace ui {
|
||||
TooltipManager();
|
||||
~TooltipManager();
|
||||
|
||||
void addTooltipFor(Widget* widget, const base::string& text, int arrowAlign = 0);
|
||||
void addTooltipFor(Widget* widget, const std::string& text, int arrowAlign = 0);
|
||||
|
||||
protected:
|
||||
bool onProcessMessage(Message* msg) OVERRIDE;
|
||||
@ -38,7 +38,7 @@ namespace ui {
|
||||
int arrowAlign;
|
||||
|
||||
TipInfo() { }
|
||||
TipInfo(const base::string& text, int arrowAlign)
|
||||
TipInfo(const std::string& text, int arrowAlign)
|
||||
: text(text), arrowAlign(arrowAlign) {
|
||||
}
|
||||
};
|
||||
|
@ -126,7 +126,7 @@ double Widget::getTextDouble() const
|
||||
return strtod(m_text.c_str(), NULL);
|
||||
}
|
||||
|
||||
void Widget::setText(const base::string& text)
|
||||
void Widget::setText(const std::string& text)
|
||||
{
|
||||
setTextQuiet(text);
|
||||
onSetText();
|
||||
@ -151,7 +151,7 @@ void Widget::setTextf(const char *format, ...)
|
||||
setText(buf);
|
||||
}
|
||||
|
||||
void Widget::setTextQuiet(const base::string& text)
|
||||
void Widget::setTextQuiet(const std::string& text)
|
||||
{
|
||||
m_text = text;
|
||||
flags |= JI_HASTEXT;
|
||||
|
@ -8,9 +8,6 @@
|
||||
#define UI_WIDGET_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/string.h"
|
||||
#include "gfx/border.h"
|
||||
#include "gfx/point.h"
|
||||
#include "gfx/rect.h"
|
||||
@ -23,6 +20,8 @@
|
||||
#include "ui/widget_type.h"
|
||||
#include "ui/widgets_list.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#define ASSERT_VALID_WIDGET(widget) ASSERT((widget) != NULL)
|
||||
|
||||
struct FONT;
|
||||
@ -88,7 +87,7 @@ namespace ui {
|
||||
|
||||
WidgetType getType() const { return this->type; }
|
||||
|
||||
const base::string& getId() const { return m_id; }
|
||||
const std::string& getId() const { return m_id; }
|
||||
void setId(const char* id) { m_id = id; }
|
||||
|
||||
int getAlign() const { return m_align; }
|
||||
@ -98,13 +97,13 @@ namespace ui {
|
||||
|
||||
bool hasText() const { return (flags & JI_HASTEXT) == JI_HASTEXT; }
|
||||
|
||||
const base::string& getText() const { return m_text; }
|
||||
const std::string& getText() const { return m_text; }
|
||||
int getTextInt() const;
|
||||
double getTextDouble() const;
|
||||
size_t getTextLength() const { return m_text.size(); }
|
||||
void setText(const base::string& text);
|
||||
void setText(const std::string& text);
|
||||
void setTextf(const char* text, ...);
|
||||
void setTextQuiet(const base::string& text);
|
||||
void setTextQuiet(const std::string& text);
|
||||
|
||||
int getTextWidth() const;
|
||||
int getTextHeight() const;
|
||||
@ -382,10 +381,10 @@ namespace ui {
|
||||
void paint(Graphics* graphics, const gfx::Region& drawRegion);
|
||||
bool paintEvent(Graphics* graphics);
|
||||
|
||||
base::string m_id; // Widget's id
|
||||
std::string m_id; // Widget's id
|
||||
Theme* m_theme; // Widget's theme
|
||||
int m_align; // Widget alignment
|
||||
base::string m_text; // Widget text
|
||||
std::string m_text; // Widget text
|
||||
struct FONT *m_font; // Text font type
|
||||
ui::Color m_bgColor; // Background color
|
||||
gfx::Rect m_bounds;
|
||||
|
@ -33,7 +33,7 @@ enum {
|
||||
static gfx::Point clickedMousePos;
|
||||
static gfx::Rect* clickedWindowPos = NULL;
|
||||
|
||||
Window::Window(Type type, const base::string& text)
|
||||
Window::Window(Type type, const std::string& text)
|
||||
: Widget(kWindowWidget)
|
||||
{
|
||||
m_killer = NULL;
|
||||
|
@ -23,7 +23,7 @@ namespace ui {
|
||||
public:
|
||||
enum Type { DesktopWindow, WithTitleBar, WithoutTitleBar };
|
||||
|
||||
explicit Window(Type type, const base::string& text = "");
|
||||
explicit Window(Type type, const std::string& text = "");
|
||||
~Window();
|
||||
|
||||
Widget* getKiller();
|
||||
|
Loading…
x
Reference in New Issue
Block a user