C++

cocos-2dxでtest用に作ったインターフェイスとマクロ

C++

namespace tt { /* * test interface */ class ITest { public: virtual ~ITest(){} virtual void test(cocos2d::Node* parent) = 0; }; #define CREATE_TEST_CLASS(CLASS_NAME) \ class CLASS_NAME : public cocos2d::Node, public ITest { \ public: \ voi…

JenkinsからのMSBuild

C++

Jenkins→[プラグインの管理]→[利用可能]→[MSBuild Plugin] Jenkins→[システムの設定]→[MSBuild] で、作成したプロジェクトの[ビルド]にMSBuild追加。 自分でバッチファイル作って同じようにmsbuildパスとソリューションパス、引数を設定しても同じようにビル…

クラス生成をマップ化

C++

#include <memory> #include <stdio.h> #include <string> #include <map> template<typename T, typename U> class ICreator { public: virtual ~ICreator(){} static T* Creator(){ return new U; } }; class Base { public: virtual ~Base(){} virtual void print() = 0; }; class A : public Base, public ICrea</typename></map></string></stdio.h></memory>…

ステートパターン

C++

ステートパターン オブジェクト指向ではモノをクラス化するが、ステートパターンでは状態をクラス化する。 前どっかの記事で見たようなテンプレートを使用した有限ステートマシンがうろ覚えで、適当なやつが完成したので、記録しておく。安全かどうかは知ら…

インターフェイス 練習

C++

test.csv cola, 10, COOL tea, 20, HOT water, 30, COOLmain.cpp // 自販機クラス #include <vector> #include <string> #include <stdio.h> #include <stdlib.h> #include <iostream> #include <fstream> enum TEMPERATURE{ DRINK_COLD, DRINK_HOT, }; class IDrink { public: virtual TEMPERATURE GetType() = 0; </fstream></iostream></stdlib.h></stdio.h></string></vector>…

フレンドクラス

C++

フレンドクラスは、フレンドと して指定した他のクラスのメンバを、 アクセス指定子とは無関係にアクセスできるようにします class Friend; class Test{ friend class Friend; Test(int num) : num_(num){ } private: int num_; } class CTestFriend { publi…

スタック

C++

//一番最後に格納したデータが取り出される. //後入れ先出し(Last In First Out)という LIFO //例 机に積み重ねられた本 積む:push 降ろす:pop //スタックを実現するには、配列中のどの位置までは使われているのかを管理する必要があります。 //この位置を管…

テンプレート

C++

テンプレート //コンパイル時にテンプレート型Tの部分が、適切な型に置き換えられます。 #include <iostream> template <class T> class CSample { public: CSample(const T& t) : t_(t){} private: T t_; };</class></iostream>

std::mapの使い方

C++

std::map< 型, 型> tbl; 型が2つ指定できるので、keyとvalueの型を自由に変更できる。 std::map<std::string, int> tbl1; tbl1["hoge"] = 0; std::map<int, std::string> tbl2; tbl2[100] = "hoge"; ↓ソース #include <iostream> #include <string> #include <map> #define msg(a) std::cout<</map></string></iostream></int,></std::string,>

構造体とクラス

C++

http://www2s.biglobe.ne.jp/~ragnarok/program/cpp/struct.htm

C++ むずい

C++

「イベント駆動」型プログラミングを調べている途中に、そのイベント駆動型プログラミングを解説しているwebページを見つけた。 http://vivi.dyndns.org/vivi/docs/Qt/event.html そのwebページの他の部分を見ていて、C++って難しいなと思った。 http://vivi…

キー

C++

WM_KEYDOWN キーボード の場合も同様で、キーが押されたとき WM_SYSKEYDOWN システムキーというのは、AltキーやF10キーのことを指します http://www.geocities.jp/ky_webid/win32c/025.html

クラス

C++

http://homepage2.nifty.com/well/Class.html