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

Go to the source code of this file.

Namespaces

namespace  pwiz
 AMTContainer.hpp.
namespace  pwiz::util

Macros

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

Functions

std::string pwiz::util::ToStdString (System::String^source)
System::String pwiz::util::ToSystemString (const std::string &source)
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 , 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

Macro Definition Documentation

#define CATCH_AND_FORWARD
Value:
catch (std::exception&) {throw;} \
catch (System::Exception^ e) \
{ \
std::vector<boost::iterator_range<std::string::const_iterator> > tokens; \
std::string function(__FUNCTION__); \
boost::algorithm::split(tokens, function, boost::is_any_of(":"), boost::algorithm::token_compress_on); \
std::string what("["); \
if (tokens.size() > 1) \
{ \
boost::range::copy(*(tokens.rbegin()+1), std::back_inserter(what)); \
what += "::"; \
if (boost::range::equal(*(tokens.rbegin()+1), *tokens.rbegin())) \
what += "ctor"; \
else if (tokens.rbegin()->front() == '~') \
what += "dtor"; \
else \
boost::range::copy(*tokens.rbegin(), std::back_inserter(what)); \
} \
else if (tokens.size() > 0) \
boost::range::copy(*tokens.rbegin(), std::back_inserter(what)); \
what += "] "; \
what += pwiz::util::ToStdString(e->Message); \
throw std::runtime_error(what); \
}

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 99 of file cpp_cli_utilities.hpp.