CConfig类
#ifndef __CONFIG_H__
#define __CONFIG_H__ #include "GameFrameHead.h" //图片信息
struct ImageInfo
{
int nId; //ID标识
string strKey; //key标识
string strFile; //文件路径
}; //资源信息
struct ResourceInfo
{ }; //ui
//控件信息
struct CtrlInfo
{
int nId;
CCPoint tPos; //坐标
CCPoint tAnchor; //锚点
CCRect rRect;
string strPic; //图片
string strText; //文本内容
string strFont; //文本字体
string strAudioFile;//声音文件
unsigned int nFontSize; //文本字体大小
unsigned int wLabelType; //文本类型
string strItem; //rollView条款
unsigned short wRollType;//roll控件类型
float fBounds; //拖动速率
string strWord; //
unsigned short wType;//控件类型
unsigned short wAlignment;//文本对齐方式
unsigned short btnState;//按钮状态
unsigned short btnType; //按钮类型
ccColor3B color3B; //文本颜色
unsigned short notType; //屏蔽消息框类型
int nPriority;//消息优先级
enum WTYPE
{
_IDC_IMG = , //图片
_IDC_STA = , //文本
_IDC_BTN = , //按钮
_IDC_SROLL = , //Sroll
_IDC_NOT = , //屏蔽消息框
_IDC_ROLL= , //滚动框
}; enum BTN_TYPE
{
_BT_Normal = , //正常
_BT_Select = , //选择
}; enum LabelType
{
_LableTTF = ,
_LabelBMFont = ,
_LabelAtlas = ,
}; }; //部件配置
struct WidgetInfo
{
int nId;
CCPoint tPos; //坐标
CCPoint tAnchor; //锚点
CCRect rRect;
string strPic; //图片
vector<CtrlInfo> m_vecCtrlInfo;
}; //场景配置
struct SceneInfo
{
int nId;
int nPosX;
int nPosY;
unsigned short wType; //条款(item)类型
unsigned short order; //层次
string strFile;
CCRect rRect;
enum WTYPE
{
_ITEM_IMG = , //图片
_ITEM_DLG = , //对话框
_ITEM_EFT = , //效果
_ITEM_STA = , //文本
_ITEM_BTN = , //按钮
};
}; //元素配置 struct PlistInfo
{
string strPlist;
string strImage;
};
struct ElementInfo
{
int nItem;
vector<PlistInfo> vecPlistInfo;
}; //动画配置
struct AnimationInfo
{
int nId; //物体ID(动画相关的物体)
int nBegan; //开始帧数
int nCount; //动画帧数
int nInterval;//帧之间的间隔
string strName; //动画名字
string plistpath; //plist路径
string texturePath;//静态贴图文件路径
string picPrefix; //资源目录--默认(或空)为物体的ID
}; //文字配置
struct WordInfo
{
string strKey;
string strLetter; //文字
}; //滚动项配置
//struct SrollInfo
//{
// int nId;
// int nPosX;
// int nPosY;
// CCRect rRect;
// string strPic;
//
// CtrlInfo ctrlInfo;
//
// unsigned short wType;//类型
//
// vector<SrollInfo> vecRollSub;
//};
//
//struct SrollViewInfo
//{
// string strKey;
// vector<SrollInfo> vecRollInfo;
//}; //滚动项配置
struct SrollInfo
{
string strKey;
vector<WidgetInfo> vecWidgetInfo;
}; //效果配置
struct EffectInfo
{
string strKey;
int nId;
int nPosX;
int nPosY;
CCRect rRect;
string strFile;
unsigned int wType;
vector<EffectInfo> vecEffectSub; enum WTYPE
{
_Particle = ,
_Action = ,
_Animation = ,
};
}; //动作配置
struct ActionInfo
{
string strKey;
int nAction;
string strDepict; //动作名字
string strParm; //参数
bool bReverse; //是否反动作
string strFile; //动作文件 enum ActionType
{
_Particle = ,
_Action = ,
_Animation = ,
}; ActionType eType; //动作类型
}; //音效配置
struct AudioInfo
{
string strKey;
unsigned int wType;
string strFile;
}; class GAMEFRAME_API CConfig
{
public:
CConfig();
~CConfig(); static CConfig* getInstance();
static void destroy();
void release(); bool loadConfig(); //读取配置文件
bool loadResourceInfo();//
bool loadImageInfo();//图片信息
bool loadAnimationInfo();//动画信息
bool loadSceneInfo();//场景信息
bool loadElementInfo();//元素 (plist)文件形式
bool loadWidgetInfo();// 控件信息
bool loadSrollInfo(); //滚动项信息
bool loadEffectInfo();//效果配置
bool loadAudioInfo();//声音配置
bool loadWordInfo();//文字配置
bool loadActionInfo();//动作配置
bool loadNumberInfo();//数字配置 bool readConfig(); //设置资源路径 一开始就要设定
void setResourcePath(const char* psPath);
string getResourcePath(); vector<ImageInfo>* getImageInfo();
ImageInfo* getImageInfoById(int nId);
ImageInfo* getImageInfoByKey(const char* psKey); vector<WidgetInfo>* getWidgetInfo();
WidgetInfo* getWidgetInfoById(int nId); vector<ElementInfo>* getElementInfo();
vector<PlistInfo>* getElementInfoByItem(int nId); map<int,vector<SceneInfo> >* getSceneInfo(); vector<AnimationInfo>* getAnimationInfo(); vector<EffectInfo>* getEffectInfo();
EffectInfo* getEffectInfoByKey(const char* psKey); vector<WidgetInfo>* getSrollInfoByKey(const char* psKey); AudioInfo* getAudioInfoByKey(const char* psKey); WordInfo& getWordInfoByKey(const char* psKey);
string getWordBykey(const char* psKey); ActionInfo* getActionInfoByKey(const char* psKey); float getNumberByKey(const char* psKey); private:
vector<string> m_vceConfigStr;
//资源路径
string m_strResourcePath;
static CConfig* g_pConfig; //图片资源配置标识
vector<ImageInfo> m_vecImageInfo; //场景配置标识
map<int, vector<SceneInfo> > m_mapSceneInfoVec; //元素(plist)配置标识
vector<ElementInfo> m_vecElement; //windget配置标识
vector<WidgetInfo> m_vecWidgetInfo; //动画配置标识
vector<AnimationInfo> m_vecAnimationInfo; //Sroll配置标识
vector<SrollInfo> m_vecSrollInfo; //效果配置
vector<EffectInfo> m_vecEffectInfo; //音效配置
vector<AudioInfo> m_vecAudioInfo; //文字配置
map<string, WordInfo> m_mapWordInfo; //动作配置
vector<ActionInfo> m_vecActionInfo; map<string, float> m_mapNumber;
}; #endif //__XCONFIG_H__
#include "Config.h"
#include "XXmlReader.h" CConfig* CConfig::g_pConfig = NULL; CConfig::CConfig()
{
m_strResourcePath.clear();
m_vecImageInfo.clear();
m_mapSceneInfoVec.clear();
m_vecElement.clear();
m_vecWidgetInfo.clear();
m_vecAnimationInfo.clear();
m_vecEffectInfo.clear();
} CConfig::~CConfig()
{ } CConfig* CConfig::getInstance()
{
if (!g_pConfig)
{
g_pConfig = new CConfig();
}
return g_pConfig;
} void CConfig::destroy()
{
g_pConfig->release();
SAFE_DELETE(g_pConfig);
} void CConfig::release()
{
m_strResourcePath.clear();
m_vecImageInfo.clear();
m_mapSceneInfoVec.clear();
m_vecElement.clear();
m_vecWidgetInfo.clear();
m_vecAnimationInfo.clear();
} bool CConfig::loadConfig()
{ return false;
} void CConfig::setResourcePath( const char* psPath )
{
m_strResourcePath = psPath;
} string CConfig::getResourcePath()
{
return m_strResourcePath;
} bool CConfig::readConfig()
{ return true;
} bool CConfig::loadImageInfo()
{
string strFile = m_strResourcePath;
strFile += "/config/image.xml"; //读取文档
xmlDocPtr pDoc = NULL;
LOAD_XML_DOC(strFile.c_str(), pDoc); if (NULL == pDoc)
{
CCLog("can not read %s", strFile.c_str());
return false;
} do
{
xmlNodePtr pRootNode = xmlDocGetRootElement(pDoc);
if (NULL == pRootNode)
{
break;
} if( != xmlStrcmp(BAD_CAST "images", pRootNode->name))
{
break;
} //读取节点
xmlNodePtr pCurNode = pRootNode->xmlChildrenNode;
while (NULL != pCurNode)
{
if ( != xmlStrcmp(pCurNode->name, BAD_CAST "image"))
{
pCurNode = pCurNode->next;
continue;
} ImageInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pCurNode, "id");
info.strKey = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "key");
info.strFile = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "file");
m_vecImageInfo.push_back(info);
pCurNode = pCurNode->next;
} xmlFreeDoc(pDoc);
return true; } while (); xmlFreeDoc(pDoc);
CCLog("read xml error : %s", strFile.c_str());
return false;
} vector<ImageInfo>* CConfig::getImageInfo()
{
return &m_vecImageInfo;
} bool CConfig::loadSceneInfo()
{
string strFile = m_strResourcePath;
strFile += "/config/scene.xml"; //读取文档
xmlDocPtr pDoc = NULL;
LOAD_XML_DOC(strFile.c_str(), pDoc); if (NULL == pDoc)
{
CCLog("can not read %s", strFile.c_str());
return false;
} do
{
xmlNodePtr pRootNode = xmlDocGetRootElement(pDoc);
if (NULL == pRootNode)
{
break;
} if( != xmlStrcmp(BAD_CAST "scenes", pRootNode->name))
{
break;
} //读取节点
xmlNodePtr pElement = pRootNode->xmlChildrenNode;
while (pElement)
{
if ( != xmlStrcmp(pElement->name, BAD_CAST "scene"))
{
pElement = pElement->next;
continue;
} xmlNodePtr pItemNode = pElement->xmlChildrenNode;
vector<SceneInfo> vecSceneInfo;
while (pItemNode)
{
if ( != xmlStrcmp(pItemNode->name, BAD_CAST "item"))
{
pItemNode = pItemNode->next;
continue;
} SceneInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pItemNode, "id");
info.wType = CCXmlReader::getXMLNodeAttribInt(&pItemNode, "type");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pItemNode, "pos");
int nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(),"%d %d %d %d %d %d",&info.nPosX,&info.nPosY,&nRectX,&nRectY,&nRectW,&nRectH);
info.rRect.setRect(nRectX,nRectY,nRectW,nRectH);
info.order = CCXmlReader::getXMLNodeAttribInt(&pItemNode, "order");
info.strFile = CCXmlReader::getXMLNodeAttribStrs(&pItemNode, "file"); vecSceneInfo.push_back(info);
pItemNode = pItemNode->next;
} int nKey = CCXmlReader::getXMLNodeAttribInt(&pElement, "id");
m_mapSceneInfoVec[nKey] = vecSceneInfo; pElement = pElement->next;
} xmlFreeDoc(pDoc);
return true; } while (); xmlFreeDoc(pDoc);
CCLog("read xml error : %s", strFile.c_str());
return false;
} bool CConfig::loadElementInfo()
{
string strFile = m_strResourcePath;
strFile += "/config/element.xml"; //读取文档
xmlDocPtr pDoc = NULL;
LOAD_XML_DOC(strFile.c_str(), pDoc); if (NULL == pDoc)
{
CCLog("can not read %s", strFile.c_str());
return false;
} do
{
xmlNodePtr pRootNode = xmlDocGetRootElement(pDoc);
if (NULL == pRootNode)
{
break;
} if( != xmlStrcmp(BAD_CAST "elements", pRootNode->name))
{
break;
}
//读取节点
xmlNodePtr pItemNode = pRootNode->xmlChildrenNode;
while (NULL != pItemNode)
{
if ( != xmlStrcmp(pItemNode->name, BAD_CAST "item"))
{
pItemNode = pItemNode->next;
continue;
} ElementInfo elemInfo;
elemInfo.nItem = CCXmlReader::getXMLNodeAttribInt(&pItemNode, "id"); xmlNodePtr pElemNode = pItemNode->xmlChildrenNode;
while(pElemNode)
{
if ( != xmlStrcmp(pElemNode->name, BAD_CAST "element"))
{
pElemNode = pElemNode->next;
continue;
}
PlistInfo info;
info.strPlist = CCXmlReader::getXMLNodeAttribStrs(&pElemNode, "plist");
info.strImage = CCXmlReader::getXMLNodeAttribStrs(&pElemNode, "image");
elemInfo.vecPlistInfo.push_back(info);
pElemNode = pElemNode->next;
} m_vecElement.push_back(elemInfo);
pItemNode = pItemNode->next;
} xmlFreeDoc(pDoc);
return true; } while (); xmlFreeDoc(pDoc);
CCLog("read xml error : %s", strFile.c_str());
return false;
} bool CConfig::loadWidgetInfo()
{
string strFile = m_strResourcePath;
strFile += "/config/widget.xml"; //读取文档
xmlDocPtr pDoc = NULL;
LOAD_XML_DOC(strFile.c_str(), pDoc); if (NULL == pDoc)
{
CCLog("can not read %s", strFile.c_str());
return false;
} do
{
xmlNodePtr pRootNode = xmlDocGetRootElement(pDoc);
if (NULL == pRootNode)
{
break;
} if( != xmlStrcmp(BAD_CAST "widgets", pRootNode->name))
{
break;
}
//读取节点
xmlNodePtr pElement = pRootNode->xmlChildrenNode;
while (NULL != pElement)
{
if ( != xmlStrcmp(pElement->name, BAD_CAST "widget"))
{
pElement = pElement->next;
continue;
} WidgetInfo widgetInfo;
widgetInfo.nId = CCXmlReader::getXMLNodeAttribInt(&pElement, "id");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pElement,"pos");
int nPosX = , nPosY = , nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(),"%d %d %d %d %d %d",&nPosX,&nPosY,&nRectX,&nRectY,&nRectW,&nRectH);
widgetInfo.tPos.setPoint(nPosX, nPosY);
widgetInfo.rRect.setRect(nRectX, nRectY, nRectW, nRectH);
strBuf = CCXmlReader::getXMLNodeAttribStrs(&pElement, "anchor");
float fAnchorX = , fAnchorY = ;
sscanf(strBuf.c_str(),"%f %f",&fAnchorX, &fAnchorY);
widgetInfo.tAnchor.setPoint(fAnchorX, fAnchorY);
widgetInfo.strPic = CCXmlReader::getXMLNodeAttribStrs(&pElement, "pic"); xmlNodePtr pCtrlNode = pElement->xmlChildrenNode;
while (pCtrlNode)
{
//图片控件
if ( == xmlStrcmp(pCtrlNode->name, BAD_CAST "img"))
{
CtrlInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "id");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode,"pos");
int nPosX = , nPosY = , nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(),"%d %d %d %d %d %d",&nPosX,&nPosY,&nRectX,&nRectY,&nRectW,&nRectH);
info.tPos.setPoint(nPosX, nPosY);
info.rRect.setRect(nRectX, nRectY, nRectW, nRectH);
info.strPic = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "pic");
strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "anchor");
float fAnchorX = , fAnchorY = ;
sscanf(strBuf.c_str(),"%f %f",&fAnchorX, &fAnchorY);
info.tAnchor.setPoint(fAnchorX, fAnchorY); info.wType = CtrlInfo::_IDC_IMG;
widgetInfo.m_vecCtrlInfo.push_back(info);
} //按钮控件
if ( == xmlStrcmp(pCtrlNode->name, BAD_CAST "btn"))
{
CtrlInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "id");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode,"pos");
int nPosX = , nPosY = , nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(),"%d %d %d %d %d %d",&nPosX,&nPosY,&nRectX,&nRectY,&nRectW,&nRectH);
info.tPos.setPoint(nPosX, nPosY);
info.rRect.setRect(nRectX, nRectY, nRectW, nRectH);
strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "anchor");
float fAnchorX = , fAnchorY = ;
sscanf(strBuf.c_str(),"%f %f",&fAnchorX, &fAnchorY); info.wType = CtrlInfo::_IDC_BTN;
info.btnType = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "type");
info.btnState = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "state");
info.strPic = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "pic");
info.strAudioFile = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "audio"); widgetInfo.m_vecCtrlInfo.push_back(info);
} //文本控件
if ( == xmlStrcmp(pCtrlNode->name, BAD_CAST "sta"))
{
CtrlInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "id");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode,"pos");
int nPosX = , nPosY = , nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(),"%d %d %d %d %d %d",&nPosX,&nPosY,&nRectX,&nRectY,&nRectW,&nRectH);
info.tPos.setPoint(nPosX, nPosY);
info.rRect.setRect(nRectX, nRectY, nRectW, nRectH);
strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "anchor");
float fAnchorX = , fAnchorY = ;
sscanf(strBuf.c_str(),"%f %f",&fAnchorX, &fAnchorY);
info.tAnchor.setPoint(fAnchorX, fAnchorY); info.wType = CtrlInfo::_IDC_STA; info.wLabelType = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "type");
info.strText = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "text");
info.nFontSize = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "fontsize");
info.strFont = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "font");
info.wAlignment = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "aligning");
strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "color");
int nR = , nG = , nB = ;
sscanf(strBuf.c_str(), "%d %d %d",&nR, &nG, &nB);
info.color3B.r = (char)nR;
info.color3B.g = (char)nG;
info.color3B.b = (char)nB;
widgetInfo.m_vecCtrlInfo.push_back(info);
} //Sroll控件
if ( == xmlStrcmp(pCtrlNode->name, BAD_CAST "srl"))
{
CtrlInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "id");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode,"pos");
int nPosX = , nPosY = , nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(),"%d %d %d %d %d %d",&nPosX,&nPosY,&nRectX,&nRectY,&nRectW,&nRectH);
info.tPos.setPoint(nPosX, nPosY);
info.rRect.setRect(nRectX, nRectY, nRectW, nRectH);
strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "anchor");
float fAnchorX = , fAnchorY = ;
sscanf(strBuf.c_str(),"%f %f",&fAnchorX, &fAnchorY);
info.tAnchor.setPoint(fAnchorX, fAnchorY); info.strItem = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "item");
info.wRollType = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "type");
info.fBounds = CCXmlReader::getXMLNodeAttribfloat(&pCtrlNode, "bounds");
info.wType = CtrlInfo::_IDC_SROLL; widgetInfo.m_vecCtrlInfo.push_back(info);
} //禁用触摸控件
if ( == xmlStrcmp(pCtrlNode->name, BAD_CAST "not"))
{
CtrlInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "id");
info.notType = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "type");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode,"pos");
int nPosX = , nPosY = , nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(),"%d %d %d %d %d %d",&nPosX,&nPosY,&nRectX,&nRectY,&nRectW,&nRectH);
info.tPos.setPoint(nPosX, nPosY);
info.rRect.setRect(nRectX, nRectY, nRectW, nRectH);
strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "anchor");
float fAnchorX = , fAnchorY = ;
sscanf(strBuf.c_str(),"%f %f",&fAnchorX, &fAnchorY);
info.tAnchor.setPoint(fAnchorX, fAnchorY); info.nPriority = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "priority");
info.wType = CtrlInfo::_IDC_NOT; widgetInfo.m_vecCtrlInfo.push_back(info);
} pCtrlNode = pCtrlNode->next;
} m_vecWidgetInfo.push_back(widgetInfo); pElement = pElement->next;
} xmlFreeDoc(pDoc);
return true; } while (); xmlFreeDoc(pDoc);
CCLog("read xml error : %s", strFile.c_str());
return false;
} vector<WidgetInfo>* CConfig::getWidgetInfo()
{
return& m_vecWidgetInfo;
} vector<ElementInfo>* CConfig::getElementInfo()
{
return& m_vecElement;
} map<int,vector<SceneInfo> >* CConfig::getSceneInfo()
{
return& m_mapSceneInfoVec;
} bool CConfig::loadAnimationInfo()
{
string strFile = m_strResourcePath;
strFile += "/config/animation.xml"; //读取文档
xmlDocPtr pDoc = NULL;
LOAD_XML_DOC(strFile.c_str(), pDoc); if (NULL == pDoc)
{
CCLog("can not read %s", strFile.c_str());
return false;
} do
{
xmlNodePtr pRootNode = xmlDocGetRootElement(pDoc);
if (NULL == pRootNode)
{
break;
} if( != xmlStrcmp(BAD_CAST "animations", pRootNode->name))
{
break;
}
//读取节点
xmlNodePtr pCurNode = pRootNode->xmlChildrenNode;
while (NULL != pCurNode)
{
if ( != xmlStrcmp(pCurNode->name, BAD_CAST "animation"))
{
pCurNode = pCurNode->next;
continue;
} AnimationInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pCurNode, "id");
info.nBegan = CCXmlReader::getXMLNodeAttribInt(&pCurNode, "began");
info.nCount = CCXmlReader::getXMLNodeAttribInt(&pCurNode, "count");
info.nInterval = CCXmlReader::getXMLNodeAttribInt(&pCurNode, "interval");
info.strName = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "name"); m_vecAnimationInfo.push_back(info); pCurNode = pCurNode->next;
} xmlFreeDoc(pDoc);
return true; } while (); xmlFreeDoc(pDoc);
CCLog("read xml error : %s", strFile.c_str());
return false; } vector<AnimationInfo>* CConfig::getAnimationInfo()
{
return &m_vecAnimationInfo;
} ImageInfo* CConfig::getImageInfoById( int nId )
{
for (vector<ImageInfo>::iterator it = m_vecImageInfo.begin(); it != m_vecImageInfo.end(); it++)
{
if (it->nId == nId)
{
return &(*it);
}
}
CCLog("error: CConfig::getPlanInfoById");
return NULL;
} WidgetInfo* CConfig::getWidgetInfoById( int nId )
{
for (vector<WidgetInfo>::iterator it = m_vecWidgetInfo.begin(); it != m_vecWidgetInfo.end(); it++)
{
if (it->nId == nId)
{
return &(*it);
}
}
CCLog("error: CConfig::getWidgetInfoById");
return NULL;
} bool CConfig::loadSrollInfo()
{
string strFile = m_strResourcePath;
strFile += "/config/sroll.xml"; //读取文档
xmlDocPtr pDoc = NULL;
LOAD_XML_DOC(strFile.c_str(), pDoc); if (NULL == pDoc)
{
CCLog("can not read %s", strFile.c_str());
return false;
} do
{
xmlNodePtr pRootNode = xmlDocGetRootElement(pDoc);
if (NULL == pRootNode)
{
break;
} if( != xmlStrcmp(BAD_CAST "srolls", pRootNode->name))
{
break;
}
//读取节点
xmlNodePtr pElement = pRootNode->xmlChildrenNode;
while (NULL != pElement)
{
if ( == xmlStrcmp(pElement->name, BAD_CAST "item"))
{
SrollInfo srollInfo;
srollInfo.strKey = CCXmlReader::getXMLNodeAttribStrs(&pElement, "key"); xmlNodePtr pWidgetNode = pElement->xmlChildrenNode;
while(pWidgetNode)
{
if ( == xmlStrcmp(pWidgetNode->name, BAD_CAST "widget"))
{
WidgetInfo widgetInfo;
widgetInfo.nId = CCXmlReader::getXMLNodeAttribInt(&pWidgetNode, "id");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pWidgetNode,"pos");
int nPosX = , nPosY = , nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(),"%d %d %d %d %d %d",&nPosX,&nPosY,&nRectX,&nRectY,&nRectW,&nRectH);
widgetInfo.tPos.setPoint(nPosX, nPosY);
widgetInfo.rRect.setRect(nRectX, nRectY, nRectW, nRectH);
widgetInfo.strPic = CCXmlReader::getXMLNodeAttribStrs(&pWidgetNode, "pic"); xmlNodePtr pCtrlNode = pWidgetNode->xmlChildrenNode;
while(pCtrlNode)
{
if ( == xmlStrcmp(pCtrlNode->name, BAD_CAST "btn"))
{
CtrlInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "id");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode,"pos");
int nPosX = , nPosY = , nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(),"%d %d %d %d %d %d",&nPosX,&nPosY,&nRectX,&nRectY,&nRectW,&nRectH);
info.tPos.setPoint(nPosX, nPosY);
info.rRect.setRect(nRectX, nRectY, nRectW, nRectH);
strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "anchor");
float fAnchorX = , fAnchorY = ;
sscanf(strBuf.c_str(),"%f %f",&fAnchorX, &fAnchorY); info.wType = CtrlInfo::_IDC_BTN;
info.btnType = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "type");
info.btnState = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "state");
info.strPic = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "pic");
info.strAudioFile = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "audio"); widgetInfo.m_vecCtrlInfo.push_back(info);
} //图片控件
if ( == xmlStrcmp(pCtrlNode->name, BAD_CAST "img"))
{
CtrlInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "id");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode,"pos");
int nPosX = , nPosY = , nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(),"%d %d %d %d %d %d",&nPosX,&nPosY,&nRectX,&nRectY,&nRectW,&nRectH);
info.tPos.setPoint(nPosX, nPosY);
info.rRect.setRect(nRectX, nRectY, nRectW, nRectH);
info.strPic = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "pic");
strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "anchor");
float fAnchorX = , fAnchorY = ;
sscanf(strBuf.c_str(),"%f %f",&fAnchorX, &fAnchorY);
info.tAnchor.setPoint(fAnchorX, fAnchorY); info.wType = CtrlInfo::_IDC_IMG;
widgetInfo.m_vecCtrlInfo.push_back(info);
} //文本控件
if ( == xmlStrcmp(pCtrlNode->name, BAD_CAST "sta"))
{
CtrlInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "id");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode,"pos");
int nPosX = , nPosY = , nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(),"%d %d %d %d %d %d",&nPosX,&nPosY,&nRectX,&nRectY,&nRectW,&nRectH);
info.tPos.setPoint(nPosX, nPosY);
info.rRect.setRect(nRectX, nRectY, nRectW, nRectH);
strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "anchor");
float fAnchorX = , fAnchorY = ;
sscanf(strBuf.c_str(),"%f %f",&fAnchorX, &fAnchorY);
info.tAnchor.setPoint(fAnchorX, fAnchorY); info.wType = CtrlInfo::_IDC_STA; info.wLabelType = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "type");
info.strText = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "text");
info.nFontSize = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "fontsize");
info.strFont = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "font");
info.wAlignment = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "aligning");
strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "color");
int nR = , nG = , nB = ;
sscanf(strBuf.c_str(), "%d %d %d",&nR, &nG, &nB);
info.color3B.r = (char)nR;
info.color3B.g = (char)nG;
info.color3B.b = (char)nB;
widgetInfo.m_vecCtrlInfo.push_back(info);
} //禁用触摸控件
if ( == xmlStrcmp(pCtrlNode->name, BAD_CAST "not"))
{
CtrlInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "id");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode,"pos");
int nPosX = , nPosY = , nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(),"%d %d %d %d %d %d",&nPosX,&nPosY,&nRectX,&nRectY,&nRectW,&nRectH);
info.tPos.setPoint(nPosX, nPosY);
info.rRect.setRect(nRectX, nRectY, nRectW, nRectH);
strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCtrlNode, "anchor");
float fAnchorX = , fAnchorY = ;
sscanf(strBuf.c_str(),"%f %f",&fAnchorX, &fAnchorY);
info.tAnchor.setPoint(fAnchorX, fAnchorY); info.nPriority = CCXmlReader::getXMLNodeAttribInt(&pCtrlNode, "priority");
info.wType = CtrlInfo::_IDC_NOT; widgetInfo.m_vecCtrlInfo.push_back(info);
} pCtrlNode = pCtrlNode->next;
} srollInfo.vecWidgetInfo.push_back(widgetInfo);
}
pWidgetNode = pWidgetNode->next;
} m_vecSrollInfo.push_back(srollInfo);
}
pElement = pElement->next;
} xmlFreeDoc(pDoc);
return true;
}while(); xmlFreeDoc(pDoc);
CCLog("read xml error : %s", strFile.c_str()); return false;
} bool CConfig::loadEffectInfo()
{
string strFile = m_strResourcePath;
strFile += "/config/effect.xml"; //读取文档
xmlDocPtr pDoc = NULL;
LOAD_XML_DOC(strFile.c_str(), pDoc); if (NULL == pDoc)
{
CCLog("can not read %s", strFile.c_str());
return false;
} do
{
xmlNodePtr pRootNode = xmlDocGetRootElement(pDoc);
if (NULL == pRootNode)
{
break;
} if( != xmlStrcmp(BAD_CAST "effects", pRootNode->name))
{
break;
}
//读取节点
xmlNodePtr pElement = pRootNode->xmlChildrenNode;
while (NULL != pElement)
{
if ( != xmlStrcmp(pElement->name, BAD_CAST "effect"))
{
pElement = pElement->next;
continue;
} EffectInfo effectInfo;
effectInfo.strKey = CCXmlReader::getXMLNodeAttribStrs(&pElement, "key");
string strEffectPosBuf = CCXmlReader::getXMLNodeAttribStrs(&pElement, "pos");
int nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strEffectPosBuf.c_str(), "%d %d %d %d %d %d", &effectInfo.nPosX, &effectInfo.nPosY,
&nRectX, &nRectY, &nRectW, &nRectH);
effectInfo.rRect.setRect(nRectX, nRectY, nRectW, nRectH); xmlNodePtr pCurNode = pElement->xmlChildrenNode;
while (pCurNode)
{
if ( == xmlStrcmp(pCurNode->name, BAD_CAST "particle"))
{
EffectInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pCurNode, "id");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "pos");
int nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(), "%d %d %d %d %d %d", &info.nPosX, &info.nPosY,
&nRectX, &nRectY, &nRectW, &nRectH);
info.rRect.setRect(nRectX, nRectY, nRectW, nRectH);
info.wType = CCXmlReader::getXMLNodeAttribInt(&pCurNode, "type");
info.strFile = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "file"); effectInfo.vecEffectSub.push_back(info);
} if ( == xmlStrcmp(pCurNode->name, BAD_CAST "action"))
{ } if ( == xmlStrcmp(pCurNode->name, BAD_CAST "Animate"))
{
EffectInfo info;
info.nId = CCXmlReader::getXMLNodeAttribInt(&pCurNode, "id");
string strBuf = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "pos");
int nRectX = , nRectY = , nRectW = , nRectH = ;
sscanf(strBuf.c_str(), "%d %d %d %d %d %d", &info.nPosX, &info.nPosY,
&nRectX, &nRectY, &nRectW, &nRectH);
info.rRect.setRect(nRectX, nRectY, nRectW, nRectH);
info.wType = CCXmlReader::getXMLNodeAttribInt(&pCurNode, "type");
info.strFile = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "file"); effectInfo.vecEffectSub.push_back(info);
} pCurNode = pCurNode->next;
} m_vecEffectInfo.push_back(effectInfo);
pElement = pElement->next;
}
xmlFreeDoc(pDoc);
return true;
} while (); xmlFreeDoc(pDoc);
CCLog("read xml error : %s", strFile.c_str());
return false;
} EffectInfo* CConfig::getEffectInfoByKey(const char* psKey)
{
for (vector<EffectInfo>::iterator it = m_vecEffectInfo.begin(); it != m_vecEffectInfo.end(); it++)
{
if ( == strcmp(it->strKey.c_str(), psKey))
{
return &(*it);
}
}
CCLog("error: CConfig::getEffectInfoByKey");
return NULL;
} vector<EffectInfo>* CConfig::getEffectInfo()
{
return &m_vecEffectInfo;
} vector<WidgetInfo>* CConfig::getSrollInfoByKey( const char* psKey )
{
for (vector<SrollInfo>::iterator it = m_vecSrollInfo.begin(); it != m_vecSrollInfo.end(); it++)
{
if (it->strKey == psKey)
{
return & it->vecWidgetInfo;
}
}
CCLog("error: CConfig::getSrollInfoByKey");
return NULL;
} bool CConfig::loadAudioInfo()
{
string strFile = m_strResourcePath;
strFile += "/config/audio.xml"; //读取文档
xmlDocPtr pDoc = NULL;
LOAD_XML_DOC(strFile.c_str(), pDoc); if (NULL == pDoc)
{
CCLog("can not read %s", strFile.c_str());
return false;
}
do
{
xmlNodePtr pRootNode = xmlDocGetRootElement(pDoc);
if (NULL == pRootNode)
{
break;
} if( != xmlStrcmp(BAD_CAST "audios", pRootNode->name))
{
break;
}
//读取节点
xmlNodePtr pCurNode = pRootNode->xmlChildrenNode;
while (NULL != pCurNode)
{
if ( != xmlStrcmp(pCurNode->name, BAD_CAST "audio"))
{
pCurNode = pCurNode->next;
continue;
} AudioInfo info;
info.strKey = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "key");
info.wType = CCXmlReader::getXMLNodeAttribInt(&pCurNode, "type");
info.strFile = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "file");
m_vecAudioInfo.push_back(info); pCurNode = pCurNode->next;
} xmlFreeDoc(pDoc);
return true; } while (); xmlFreeDoc(pDoc);
CCLog("read xml error : %s", strFile.c_str());
return false;
} AudioInfo* CConfig::getAudioInfoByKey( const char* psKey )
{
for (vector<AudioInfo>::iterator it = m_vecAudioInfo.begin(); it != m_vecAudioInfo.end(); it++)
{
if ( == strcmp(it->strKey.c_str(), psKey))
{
return &(*it);
}
} CCLog("error: CConfig::getAudioInfoByKey");
return NULL;
} vector<PlistInfo>* CConfig::getElementInfoByItem( int nId )
{
for (vector<ElementInfo>::iterator it = m_vecElement.begin(); it != m_vecElement.end(); it++)
{
if (it->nItem == nId)
{
return &it->vecPlistInfo;
}
}
CCLog("error: CConfig::getElementInfoById");
return NULL;
} ImageInfo* CConfig::getImageInfoByKey( const char* psKey )
{
for (vector<ImageInfo>::iterator it = m_vecImageInfo.begin(); it != m_vecImageInfo.end(); it++)
{
if ( it->strKey == psKey)
{
return &(*it);
}
}
CCLog("error: CConfig::getImageInfoByKey");
return NULL;
} bool CConfig::loadWordInfo()
{
string strFile = m_strResourcePath;
strFile += "/config/word.xml"; //读取文档
xmlDocPtr pDoc = NULL;
LOAD_XML_DOC(strFile.c_str(), pDoc); if (NULL == pDoc)
{
CCLog("can not read %s", strFile.c_str());
return false;
}
do
{
xmlNodePtr pRootNode = xmlDocGetRootElement(pDoc);
if (NULL == pRootNode)
{
break;
} if( != xmlStrcmp(BAD_CAST "words", pRootNode->name))
{
break;
}
//读取节点
xmlNodePtr pCurNode = pRootNode->xmlChildrenNode;
while (NULL != pCurNode)
{
if ( != xmlStrcmp(pCurNode->name, BAD_CAST "word"))
{
pCurNode = pCurNode->next;
continue;
} WordInfo info;
info.strKey = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "key");
info.strLetter = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "letter");
m_mapWordInfo[info.strKey] = info; pCurNode = pCurNode->next;
} xmlFreeDoc(pDoc);
return true; } while (); xmlFreeDoc(pDoc);
CCLog("read xml error : %s", strFile.c_str());
return false;
} WordInfo& CConfig::getWordInfoByKey( const char* psKey )
{
return m_mapWordInfo[psKey];
} string CConfig::getWordBykey( const char* psKey )
{
for (map<string, WordInfo>::iterator it = m_mapWordInfo.begin(); it != m_mapWordInfo.end(); it++)
{
if (it->first == psKey)
{
return it->second.strLetter;
}
}
CCLog("warning: CConfig::getWordByKey");
return "";
} bool CConfig::loadActionInfo()
{
string strFile = m_strResourcePath;
strFile += "/config/action.xml"; //读取文档
xmlDocPtr pDoc = NULL;
LOAD_XML_DOC(strFile.c_str(), pDoc); if (NULL == pDoc)
{
CCLog("can not read %s", strFile.c_str());
return false;
}
do
{
xmlNodePtr pRootNode = xmlDocGetRootElement(pDoc);
if (NULL == pRootNode)
{
break;
} if( != xmlStrcmp(BAD_CAST "actions", pRootNode->name))
{
break;
}
//读取节点
xmlNodePtr pCurNode = pRootNode->xmlChildrenNode;
while (NULL != pCurNode)
{
if ( == xmlStrcmp(pCurNode->name, BAD_CAST "action"))
{
ActionInfo info;
info.strKey = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "key");
info.nAction = CCXmlReader::getXMLNodeAttribInt(&pCurNode, "type");
info.strParm = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "parm"); info.eType = ActionInfo::_Action; m_vecActionInfo.push_back(info);
}
if ( == xmlStrcmp(pCurNode->name, BAD_CAST "particle"))
{
ActionInfo info;
info.strKey = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "key");
info.strFile = CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "file"); info.eType = ActionInfo::_Particle; m_vecActionInfo.push_back(info);
} pCurNode = pCurNode->next;
} xmlFreeDoc(pDoc);
return true; } while (); xmlFreeDoc(pDoc);
CCLog("read xml error : %s", strFile.c_str());
return false;
} ActionInfo* CConfig::getActionInfoByKey( const char* psKey )
{
for (vector<ActionInfo>::iterator it = m_vecActionInfo.begin(); it != m_vecActionInfo.end(); it++)
{
if (it->strKey == psKey)
{
return &(*it);
}
} CCLog("error: CConfig::getActionInfoByKey");
return NULL;
} bool CConfig::loadNumberInfo()
{
string strFile = m_strResourcePath;
strFile += "/config/number.xml"; //读取文档
xmlDocPtr pDoc = NULL;
LOAD_XML_DOC(strFile.c_str(), pDoc); if (NULL == pDoc)
{
CCLog("can not read %s", strFile.c_str());
return false;
}
do
{
xmlNodePtr pRootNode = xmlDocGetRootElement(pDoc);
if (NULL == pRootNode)
{
break;
} if( != xmlStrcmp(BAD_CAST "numbers", pRootNode->name))
{
break;
}
//读取节点
xmlNodePtr pCurNode = pRootNode->xmlChildrenNode;
while (NULL != pCurNode)
{
if ( == xmlStrcmp(pCurNode->name, BAD_CAST "number"))
{
m_mapNumber[CCXmlReader::getXMLNodeAttribStrs(&pCurNode, "key")]
= CCXmlReader::getXMLNodeAttribfloat(&pCurNode, "num");
} pCurNode = pCurNode->next;
} xmlFreeDoc(pDoc);
return true; } while (); xmlFreeDoc(pDoc);
CCLog("read xml error : %s", strFile.c_str());
return false; } float CConfig::getNumberByKey( const char* psKey )
{
return m_mapNumber[psKey];
}
CConfig类的更多相关文章
- Java类的继承与多态特性-入门笔记
相信对于继承和多态的概念性我就不在怎么解释啦!不管你是.Net还是Java面向对象编程都是比不缺少一堂课~~Net如此Java亦也有同样的思想成分包含其中. 继承,多态,封装是Java面向对象的3大特 ...
- C++ 可配置的类工厂
项目中常用到工厂模式,工厂模式可以把创建对象的具体细节封装到Create函数中,减少重复代码,增强可读和可维护性.传统的工厂实现如下: class Widget { public: virtual i ...
- Android请求网络共通类——Hi_博客 Android App 开发笔记
今天 ,来分享一下 ,一个博客App的开发过程,以前也没开发过这种类型App 的经验,求大神们轻点喷. 首先我们要创建一个Andriod 项目 因为要从网络请求数据所以我们先来一个请求网络的共通类. ...
- ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第二章:利用模型类创建视图、控制器和数据库
在这一章中,我们将直接进入项目,并且为产品和分类添加一些基本的模型类.我们将在Entity Framework的代码优先模式下,利用这些模型类创建一个数据库.我们还将学习如何在代码中创建数据库上下文类 ...
- ASP.NET Core 折腾笔记二:自己写个完整的Cache缓存类来支持.NET Core
背景: 1:.NET Core 已经没System.Web,也木有了HttpRuntime.Cache,因此,该空间下Cache也木有了. 2:.NET Core 有新的Memory Cache提供, ...
- .NET Core中间件的注册和管道的构建(2)---- 用UseMiddleware扩展方法注册中间件类
.NET Core中间件的注册和管道的构建(2)---- 用UseMiddleware扩展方法注册中间件类 0x00 为什么要引入扩展方法 有的中间件功能比较简单,有的则比较复杂,并且依赖其它组件.除 ...
- Java基础Map接口+Collections工具类
1.Map中我们主要讲两个接口 HashMap 与 LinkedHashMap (1)其中LinkedHashMap是有序的 怎么存怎么取出来 我们讲一下Map的增删改查功能: /* * Ma ...
- PHP-解析验证码类--学习笔记
1.开始 在 网上看到使用PHP写的ValidateCode生成验证码码类,感觉不错,特拿来分析学习一下. 2.类图 3.验证码类部分代码 3.1 定义变量 //随机因子 private $char ...
- C# 多种方式发送邮件(附帮助类)
因项目业务需要,需要做一个发送邮件功能,查了下资料,整了整,汇总如下,亲测可用- QQ邮箱发送邮件 #region 发送邮箱 try { MailMessage mail = new MailMess ...
随机推荐
- cocos2d-x v3.0各个环境下创建项目以及编译、执行官方DEMO
摘自:https://github.com/cocos2d/cocos2d-x/ 怎样创建一个新项目 How to start a new game Download the code from co ...
- Spring持久化
1. Spring的DAO理念 Spring提供了一套抽象的DAO类,供开发者扩展,这有利于以统一的方式操作各种DAO技术,如JDO.JDBC等,这些抽象DAO类提供了设置数据源及相关辅助信息的方法, ...
- Thinkphp学习笔记-controller与view绑定
$this->display(); 通过上面的代码则可以输出controller所对应的view
- php stdClass 的使用
原文:http://www.php.cn/php-weizijiaocheng-371767.html ------------------------------------------------ ...
- mac远程桌面Microsoft Remote Desktop for Mac的安装与使用
mac远程桌面Microsoft Remote Desktop for Mac的安装与使用 学习了:https://blog.csdn.net/ytangdigl/article/details/78 ...
- 退出app 退出应用程序
退出app的两种方式1 创建activity的基类,让所有的activity都继承该基类,在基类中创建一个静态的activity列表,并在oncreate方法添加该activity,在退出时,遍历 ...
- java创建二叉树并递归遍历二叉树
二叉树类代码: package binarytree; import linkqueue.LinkQueue; public class BinaryTree { class Node { publi ...
- AUC(Area Under roc Curve)学习笔记
AUC是一种用来度量分类模型好坏的一个标准. ROC分析是从医疗分析领域引入了一种新的分类模型performance评判方法. ROC的全名叫做Receiver Operating Character ...
- 【转】使用python进行多线程编程
1. python对多线程的支持 1)虚拟机层面 Python虚拟机使用GIL(Global Interpreter Lock,全局解释器锁)来互斥线程对共享资源的访问,暂时无法利用多处理器的优势.使 ...
- MySQL之myisamchk
Description, check and repair of MyISAM tables.Used without options all tables on the command will b ...