Skip to content

Commit

Permalink
Test std::vector<std::string> in python.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhcad committed Nov 9, 2011
1 parent ec9787d commit 8dee581
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
6 changes: 3 additions & 3 deletions code/pkg_Platform/Modules/x3core/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@ void UnloadPlugins()
s_loader.Unload();
}

std::vector<std::wstring> GetPluginFiles()
std::vector<std::string> GetPluginFiles()
{
Cx_Interface<Ix_PluginLoader2> loader(s_loader.GetPluginLoader());
ASSERT(loader.IsNotNull());

std::vector<std::wstring> filenames;
std::vector<std::string> filenames;
HMODULE hdll;
std::wstring filename;

for (int i = 0; loader->GetPluginFileName(i, hdll, filename); i++)
{
filenames.push_back(filename);
filenames.push_back(x3::w2a(filename));
}

return filenames;
Expand Down
3 changes: 1 addition & 2 deletions code/pkg_Platform/Modules/x3core/testcore.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import x3core as C

assert(C.LoadPluginFiles("ChangeManager"))
files = C.GetPluginFiles()
print(files)
for f in C.GetPluginFiles(): print(f)

C.UnloadPlugins()
14 changes: 7 additions & 7 deletions code/pkg_Platform/Modules/x3core/x3core.i
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
%module x3core

%{
#include <UtilFunc/vecfunc.h>
using namespace std;
typedef vector<wstring> WStrVector;
#include <vector>
#include <string>

bool LoadCorePlugins();
bool LoadAllPlugins();
bool LoadPluginFiles(const char* files);
void UnloadPlugins();
std::vector<std::wstring> GetPluginFiles();
std::vector<std::string> GetPluginFiles();
%}

%include stl.i
using namespace std;
%include std_vector.i
%include std_string.i

%template(WStrVector) vector<wstring>;
%template(StrVector) std::vector<std::string>;

bool LoadCorePlugins();
bool LoadAllPlugins();
bool LoadPluginFiles(const char* files);
void UnloadPlugins();
WStrVector GetPluginFiles();
std::vector<std::string> GetPluginFiles();
2 changes: 1 addition & 1 deletion projects/msvc/vcproj/swig.rule
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<CustomBuildRule
Name="swig -python"
DisplayName="swig -python"
CommandLine="swig.exe -c++ -python -I$(ProjectDir)..\..\..\code\pkg_Core\Interface -outdir $(OutDir) $(InputPath)"
CommandLine="if not exist $(OutDir) mkdir $(OutDir)&#x0D;&#x0A;swig.exe -c++ -python -I$(ProjectDir)..\..\..\code\pkg_Core\Interface -outdir $(OutDir) $(InputPath)"
Outputs="$(InputName)._swig"
FileExtensions="*.i"
ExecutionDescription="swig generating"
Expand Down

0 comments on commit 8dee581

Please sign in to comment.