use boost stuff

This commit is contained in:
Eduardo Bart 2011-04-11 18:22:01 -03:00
parent 08b6563fd5
commit 83b166e91e
21 changed files with 40 additions and 37 deletions

View File

@ -82,6 +82,6 @@ private:
Size m_cornersSize;
};
typedef std::shared_ptr<BorderedImage> BorderedImagePtr;
typedef boost::shared_ptr<BorderedImage> BorderedImagePtr;
#endif // BORDEREDIMAGE_H

View File

@ -92,6 +92,6 @@ private:
Size m_glyphsSize[256];
};
typedef std::shared_ptr<Font> FontPtr;
typedef boost::shared_ptr<Font> FontPtr;
#endif // FONT_H

View File

@ -44,6 +44,6 @@ protected:
Rect m_textureCoords;
};
typedef std::shared_ptr<Image> ImagePtr;
typedef boost::shared_ptr<Image> ImagePtr;
#endif // IMAGE_H

View File

@ -52,6 +52,6 @@ private:
Size m_size;
};
typedef std::shared_ptr<Texture> TexturePtr;
typedef boost::shared_ptr<Texture> TexturePtr;
#endif // TEXTURE_H

View File

@ -28,7 +28,7 @@
#include "prerequisites.h"
#include "texture.h"
typedef std::weak_ptr<Texture> TextureWeakPtr;
typedef boost::weak_ptr<Texture> TextureWeakPtr;
class Textures
{

View File

@ -33,15 +33,16 @@
class TestState;
class Protocol;
class Connections;
class Connection;
class Connection : public std::enable_shared_from_this<Connection>
class Connection : public boost::enable_shared_from_this<Connection>
{
public:
typedef std::function<void()> ConnectionCallback;
typedef std::function<void(NetworkMessagePtr)> RecvCallback;
typedef std::function<void(const boost::system::error_code&, const std::string&)> ErrorCallback;
typedef boost::function<void()> ConnectionCallback;
typedef boost::function<void(NetworkMessagePtr)> RecvCallback;
typedef boost::function<void(const boost::system::error_code&, const std::string&)> ErrorCallback;
typedef std::shared_ptr<Connection> ConnectionPtr;
typedef boost::shared_ptr<Connection> ConnectionPtr;
private:
Connection(boost::asio::io_service& ioService);
@ -94,6 +95,6 @@ private:
friend class Connections;
};
typedef std::shared_ptr<Connection> ConnectionPtr;
typedef boost::shared_ptr<Connection> ConnectionPtr;
#endif //CONNECTION_h

View File

@ -92,6 +92,6 @@ protected:
uint8 m_msgBuf[NETWORKMESSAGE_MAXSIZE];
};
typedef std::shared_ptr<NetworkMessage> NetworkMessagePtr;
typedef boost::shared_ptr<NetworkMessage> NetworkMessagePtr;
#endif //NETWORKMESSAGE_H

View File

@ -58,16 +58,18 @@ typedef int8_t int8;
#include <map>
#include <string>
#include <list>
#include <memory>
// boost utilities
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#define foreach BOOST_FOREACH
typedef std::function<void()> Callback;
typedef boost::function<void()> Callback;
// yaml
#include <yaml-cpp/yaml.h>

View File

@ -51,6 +51,6 @@ private:
Callback m_buttonClickCallback;
};
typedef std::shared_ptr<UIButton> UIButtonPtr;
typedef boost::shared_ptr<UIButton> UIButtonPtr;
#endif // UIBUTTON_H

View File

@ -48,7 +48,7 @@ public:
virtual UI::EElementType getElementType() const { return UI::Container; }
UIContainerPtr asUIContainer() { return std::static_pointer_cast<UIContainer>(shared_from_this()); }
UIContainerPtr asUIContainer() { return boost::static_pointer_cast<UIContainer>(shared_from_this()); }
static UIContainerPtr& getRootContainer();

View File

@ -33,12 +33,12 @@
class UIElementSkin;
class UIContainer;
typedef std::shared_ptr<UIContainer> UIContainerPtr;
typedef std::weak_ptr<UIContainer> UIContainerWeakPtr;
typedef boost::shared_ptr<UIContainer> UIContainerPtr;
typedef boost::weak_ptr<UIContainer> UIContainerWeakPtr;
class UIElement;
typedef std::shared_ptr<UIElement> UIElementPtr;
typedef std::weak_ptr<UIElement> UIElementWeakPtr;
typedef boost::shared_ptr<UIElement> UIElementPtr;
typedef boost::weak_ptr<UIElement> UIElementWeakPtr;
class UIElement : public UILayout
{
@ -72,7 +72,7 @@ public:
UI::EElementType getElementType() const { return m_type; }
UIElementPtr asUIElement() { return std::static_pointer_cast<UIElement>(shared_from_this()); }
UIElementPtr asUIElement() { return boost::static_pointer_cast<UIElement>(shared_from_this()); }
virtual UIContainerPtr asUIContainer() { return UIContainerPtr(); }
friend class UIContainer;

View File

@ -43,6 +43,6 @@ private:
std::string m_text;
};
typedef std::shared_ptr<UILabel> UILabelPtr;
typedef boost::shared_ptr<UILabel> UILabelPtr;
#endif // UILABEL_H

View File

@ -39,8 +39,8 @@ enum EAnchorType {
};
class UILayout;
typedef std::shared_ptr<UILayout> UILayoutPtr;
typedef std::weak_ptr<UILayout> UILayoutWeakPtr;
typedef boost::shared_ptr<UILayout> UILayoutPtr;
typedef boost::weak_ptr<UILayout> UILayoutWeakPtr;
class AnchorLine
{
@ -62,7 +62,7 @@ private:
EAnchorType m_anchorType;
};
class UILayout : public std::enable_shared_from_this<UILayout>
class UILayout : public boost::enable_shared_from_this<UILayout>
{
public:
UILayout() :

View File

@ -194,17 +194,17 @@ void UILoader::loadElement(const UIElementPtr& element, const YAML::Node& node)
// load specific element type
if(element->getElementType() == UI::Button) {
UIButtonPtr button = std::static_pointer_cast<UIButton>(element);
UIButtonPtr button = boost::static_pointer_cast<UIButton>(element);
node["text"] >> tmp;
button->setText(tmp);
}
else if(element->getElementType() == UI::Window) {
UIWindowPtr window = std::static_pointer_cast<UIWindow>(element);
UIWindowPtr window = boost::static_pointer_cast<UIWindow>(element);
node["title"] >> tmp;
window->setTitle(tmp);
}
else if(element->getElementType() == UI::Label) {
UILabelPtr label = std::static_pointer_cast<UILabel>(element);
UILabelPtr label = boost::static_pointer_cast<UILabel>(element);
node["text"] >> tmp;
label->setText(tmp);
}

View File

@ -35,6 +35,6 @@ public:
UIPanel() : UIContainer(UI::Panel) { }
};
typedef std::shared_ptr<UIPanel> UIPanelPtr;
typedef boost::shared_ptr<UIPanel> UIPanelPtr;
#endif // UIPANEL_H

View File

@ -57,6 +57,6 @@ private:
std::string m_text;
};
typedef std::shared_ptr<UITextEdit> UITextEditPtr;
typedef boost::shared_ptr<UITextEdit> UITextEditPtr;
#endif // UITEXTEDIT_H

View File

@ -41,6 +41,6 @@ private:
std::string m_title;
};
typedef std::shared_ptr<UIWindow> UIWindowPtr;
typedef boost::shared_ptr<UIWindow> UIWindowPtr;
#endif // UIWINDOW_H

View File

@ -43,6 +43,6 @@ protected:
mpz_t m_p, m_q, m_u, m_d, m_dp, m_dq, m_mod;
};
typedef std::shared_ptr<Rsa> RsaPtr;
typedef boost::shared_ptr<Rsa> RsaPtr;
#endif //RSA_H

View File

@ -113,8 +113,8 @@ int main(int argc, const char *argv[])
// state scope
{
std::shared_ptr<MenuState> initialState(new MenuState);
//std::shared_ptr<TestState> initialState(new TestState);
boost::shared_ptr<MenuState> initialState(new MenuState);
//boost::shared_ptr<TestState> initialState(new TestState);
g_dispatcher.addTask(boost::bind(&Engine::changeState, &g_engine, initialState.get()));
Platform::showWindow();

View File

@ -41,10 +41,10 @@ void MenuState::onEnter()
UIContainerPtr mainMenuPanel = UILoader::loadFile("ui/mainMenu.yml")->asUIContainer();
UIButtonPtr button = std::static_pointer_cast<UIButton>(mainMenuPanel->getChildById("exitGameButton"));
UIButtonPtr button = boost::static_pointer_cast<UIButton>(mainMenuPanel->getChildById("exitGameButton"));
button->setOnClick(boost::bind(&MenuState::onClose, this));
button = std::static_pointer_cast<UIButton>(mainMenuPanel->getChildById("enterGameButton"));
button = boost::static_pointer_cast<UIButton>(mainMenuPanel->getChildById("enterGameButton"));
button->setOnClick(boost::bind(&MenuState::enterGameButton_clicked, this));
}

View File

@ -50,6 +50,6 @@ private:
static const char* rsa;
};
typedef std::shared_ptr<ProtocolTibia87> ProtocolTibia87Ptr;
typedef boost::shared_ptr<ProtocolTibia87> ProtocolTibia87Ptr;
#endif //PROTOCOLTIBIA87_H