Merge branch 'dev' of https://github.com/vnpy/vnpy into dev
This commit is contained in:
commit
5001d6ef9d
9
.gitignore
vendored
9
.gitignore
vendored
@ -43,6 +43,15 @@ Release/
|
|||||||
*.log
|
*.log
|
||||||
*.bak
|
*.bak
|
||||||
|
|
||||||
|
# 编译临时文件夹
|
||||||
|
build/
|
||||||
|
|
||||||
|
# CMake临时文件
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles/
|
||||||
|
build/cmake_install.cmake
|
||||||
|
build/Makefile
|
||||||
|
|
||||||
# 目录
|
# 目录
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
|
@ -4,6 +4,10 @@ cache: pip
|
|||||||
python:
|
python:
|
||||||
- 2.7
|
- 2.7
|
||||||
- 3.6
|
- 3.6
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- dev
|
||||||
install:
|
install:
|
||||||
- pip install -r requirements.txt
|
- pip install -r requirements.txt
|
||||||
- pip install flake8 # pytest # add another testing frameworks later
|
- pip install flake8 # pytest # add another testing frameworks later
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
///从Python对象到C++类型转换用的函数
|
///从Python对象到C++类型转换用的函数
|
||||||
///-------------------------------------------------------------------------------------
|
///-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void getInt(dict d, string key, int *value)
|
void getInt(dict d, const string &key, int *value)
|
||||||
{
|
{
|
||||||
if (d.has_key(key)) //检查字典中是否存在该键值
|
if (d.has_key(key)) //检查字典中是否存在该键值
|
||||||
{
|
{
|
||||||
@ -20,7 +20,7 @@ void getInt(dict d, string key, int *value)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void getDouble(dict d, string key, double *value)
|
void getDouble(dict d, const string &key, double *value)
|
||||||
{
|
{
|
||||||
if (d.has_key(key))
|
if (d.has_key(key))
|
||||||
{
|
{
|
||||||
@ -33,7 +33,9 @@ void getDouble(dict d, string key, double *value)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void getStr(dict d, string key, char *value)
|
// 使用特化的strcpy_s,能提升性能
|
||||||
|
template <class CharType, size_t size>
|
||||||
|
void getStr(dict d, const string &key, const CharType(&value)[size])
|
||||||
{
|
{
|
||||||
if (d.has_key(key))
|
if (d.has_key(key))
|
||||||
{
|
{
|
||||||
@ -43,18 +45,18 @@ void getStr(dict d, string key, char *value)
|
|||||||
{
|
{
|
||||||
string s = x();
|
string s = x();
|
||||||
const char *buffer = s.c_str();
|
const char *buffer = s.c_str();
|
||||||
//对字符串指针赋值必须使用strcpy_s, vs2013使用strcpy编译通不过
|
|
||||||
//+1应该是因为C++字符串的结尾符号?不是特别确定,不加这个1会出错
|
|
||||||
#ifdef _MSC_VER //WIN32
|
#ifdef _MSC_VER //WIN32
|
||||||
strcpy_s(value, strlen(buffer) + 1, buffer);
|
strcpy_s(value, buffer);
|
||||||
#elif __GNUC__
|
#elif __GNUC__
|
||||||
strncpy(value, buffer, strlen(buffer) + 1);
|
strncpy(value, buffer, strlen(buffer) + 1);
|
||||||
|
#else
|
||||||
|
#pragma error("unsupported compiler")
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
void getChar(dict d, string key, char *value)
|
void getChar(dict d, const string &key, char *value)
|
||||||
{
|
{
|
||||||
if (d.has_key(key))
|
if (d.has_key(key))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user