Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Created September 3, 2014 16:50
Show Gist options
  • Save springmeyer/83f8c94a43a01e667414 to your computer and use it in GitHub Desktop.
Save springmeyer/83f8c94a43a01e667414 to your computer and use it in GitHub Desktop.
win debug variant
#include <iostream>
#include <mapnik/util/variant.hpp>
#include <mapnik/value.hpp>
#include <mapnik/unicode.hpp>
#include <ostream>
//#include <mapnik/feature.hpp>
//#include <mapnik/feature_factory.hpp>
int main() {
mapnik::value val = 0.0;
std::clog << val << "\n";
mapnik::transcoder tr("utf8");
mapnik::value s(tr.transcode("hello"));
std::clog << "is string: " << s.base().is<mapnik::value_unicode_string>() << "\n";
std::string utf8;
//std::clog << s.base() << "\n";
double attr = double(0);
mapnik::value _val(attr);
std::clog << "is double: " << _val.base().is<double>() << "\n";
std::clog << "base: " << _val << "\n";
mapnik::value val2 = .091;
std::clog << "is double: " << val2.base().is<double>() << "\n";
std::clog << "base: " << val2 << "\n";
std::clog << typeid(mapnik::value_double).name() << "\n";
using variant_type = mapnik::util::variant<mapnik::value_bool,mapnik::value_double>;
//typedef mapnik::util::variant<bool,double> variant_type;
//variant_type var2(double(2.2));
//std::clog << "variant is double "<< var2.is<double>() << "\n";
/*
std::clog << "yes\n";
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
ctx->push("num");
mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1));
feature->put("num",attr);
std::clog << *feature << "\n";
std::clog << feature->get("num") << "\n";
mapnik::feature_impl::cont_type const& data = feature->get_data();
std::clog << "size: " << data.size() << "\n";
mapnik::value val = data[0];
mapnik::value_base base = val.base();
std::clog << "Valid: " << base.valid() << "\n";
std::clog << "is bool: " << base.is<bool>() << "\n";
*/
return 0;
}
@echo off
:: run tests
SET PATH=%CD%\..\mapnik-sdk\libs;%PATH%
cl /MD /nologo /EHsc feat.cpp /I include /I ../mapnik-sdk\includes /c
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
link /nologo feat.obj /LIBPATH:../mapnik-sdk\libs mapnik.lib icuuc.lib
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
.\feat
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO DONE
:ERROR
echo ----------ERROR MAPNIK --------------
echo ERRORLEVEL %ERRORLEVEL%
:DONE
EXIT /b %ERRORLEVEL%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment