ProteoWizard
Classes | Namespaces | Macros | Functions
cpp_cli_utilities.hpp File Reference
#include <gcroot.h>
#include <vcclr.h>
#include <comdef.h>
#include <vector>
#include <string>
#include <stdexcept>
#include <boost/algorithm/string/split.hpp>
#include <boost/range/algorithm/copy.hpp>
#include "automation_vector.h"
#include "BinaryData.hpp"

Go to the source code of this file.

Classes

class  pwiz::util::Lock
 

Namespaces

namespace  pwiz
 
namespace  pwiz::util
 

Macros

#define WIN32_LEAN_AND_MEAN
 
#define NOGDI
 
#define NOMINMAX
 
#define CATCH_AND_FORWARD_EX(param)
 forwards managed exception to unmanaged code; prepends function with a single level of scope, e.g.
 
#define CATCH_AND_FORWARD   CATCH_AND_FORWARD_EX("")
 

Functions

std::string pwiz::util::ToStdString (System::String^ source)
 
System::String pwiz::util::ToSystemString (const std::string &source, bool utf8=true)
 
template<typename managed_value_type , typename native_value_type >
void pwiz::util::ToStdVector (cli::array< managed_value_type >^ managedArray, std::vector< native_value_type > &stdVector)
 
template<typename managed_value_type >
void pwiz::util::ToStdVector (cli::array< managed_value_type >^ managedArray, std::vector< std::string > &stdVector)
 
template<typename native_value_type , typename managed_value_type >
std::vector< native_value_type > pwiz::util::ToStdVector (cli::array< managed_value_type >^ managedArray)
 
template<typename managed_value_type , typename native_value_type >
void pwiz::util::ToStdVector (cli::array< managed_value_type >^ managedArray, int sourceIndex, std::vector< native_value_type > &stdVector, int destinationIndex, int count)
 
template<typename managed_value_type , typename native_value_type >
void pwiz::util::ToStdVector (System::Collections::Generic::IList< managed_value_type >^ managedList, std::vector< native_value_type > &stdVector)
 
template<typename managed_value_type , typename native_value_type >
void pwiz::util::ToAutomationVector (cli::array< managed_value_type >^ managedArray, automation_vector< native_value_type > &automationArray)
 wraps a managed array in an automation_vector to enable direct access from unmanaged code
 
template<typename managed_value_type , typename native_value_type >
void pwiz::util::ToBinaryData (cli::array< managed_value_type >^ managedArray, BinaryData< native_value_type > &binaryData)
 
template<typename managed_value_type , typename native_value_type >
void pwiz::util::ToBinaryData (cli::array< managed_value_type >^ managedArray, int sourceIndex, BinaryData< native_value_type > &binaryData, int destinationIndex, int count)
 
template<typename managed_value_type , typename native_value_type >
void pwiz::util::ToBinaryData (System::Collections::Generic::IList< managed_value_type >^ managedList, BinaryData< native_value_type > &binaryData)
 

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 26 of file cpp_cli_utilities.hpp.

◆ NOGDI

#define NOGDI

Definition at line 27 of file cpp_cli_utilities.hpp.

◆ NOMINMAX

#define NOMINMAX

Definition at line 30 of file cpp_cli_utilities.hpp.

◆ CATCH_AND_FORWARD_EX

#define CATCH_AND_FORWARD_EX (   param)
Value:
catch (std::exception&) {throw;} \
catch (_com_error& e) {throw std::runtime_error(std::string("COM error: ") + e.ErrorMessage());} \
/*catch (CException* e) {std::auto_ptr<CException> exceptionDeleter(e); char message[1024]; e->GetErrorMessage(message, 1024); throw std::runtime_error(string("MFC error: ") + message);}*/ \
catch (System::AggregateException^ e) { throw std::runtime_error(trimFunctionMacro(__FUNCTION__, (param)) + pwiz::util::ToStdString(e->ToString())); } \
catch (System::Exception^ e) { throw std::runtime_error(trimFunctionMacro(__FUNCTION__, (param)) + pwiz::util::ToStdString(e->Message)); }
std::string ToStdString(System::String^ source)

forwards managed exception to unmanaged code; prepends function with a single level of scope, e.g.

"Reader::read()" instead of "pwiz::data::msdata::Reader::read()"

Definition at line 244 of file cpp_cli_utilities.hpp.

245 {throw;} \
246 catch (_com_error& e) {throw std::runtime_error(std::string("COM error: ") + e.ErrorMessage());} \
247 /*catch (CException* e) {std::auto_ptr<CException> exceptionDeleter(e); char message[1024]; e->GetErrorMessage(message, 1024); throw std::runtime_error(string("MFC error: ") + message);}*/ \
248 catch (System::AggregateException^ e) { throw std::runtime_error(trimFunctionMacro(__FUNCTION__, (param)) + pwiz::util::ToStdString(e->ToString())); } \
249 catch (System::Exception^ e) { throw std::runtime_error(trimFunctionMacro(__FUNCTION__, (param)) + pwiz::util::ToStdString(e->Message)); }

◆ CATCH_AND_FORWARD

#define CATCH_AND_FORWARD   CATCH_AND_FORWARD_EX("")

Definition at line 251 of file cpp_cli_utilities.hpp.