~unity-team/go-unityscopes/v2

« back to all changes in this revision

Viewing changes to reply.cpp

  • Committer: Xavi Garcia
  • Date: 2015-03-25 08:14:19 UTC
  • mfrom: (55.1.7 v1)
  • Revision ID: xavi.garcia.mena@canonical.com-20150325081419-zzuy0a8t0jmmha8x
mergedĀ lp:~xavi-garcia-mena/go-unityscopes/version-rtm-compatibility

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <stdexcept>
2
2
#include <cstring>
 
3
#include <iostream>
3
4
 
4
5
#include <unity/scopes/PreviewReply.h>
5
6
#include <unity/scopes/SearchReply.h>
 
7
#include <unity/scopes/Version.h>
6
8
 
7
9
extern "C" {
8
10
#include "_cgo_export.h"
54
56
}
55
57
 
56
58
void search_reply_push_filters(SharedPtrData reply, void *filters_json, void *filter_state_json, char **error) {
 
59
#if UNITY_SCOPES_VERSION_MAJOR == 0 && (UNITY_SCOPES_VERSION_MINOR < 6 || (UNITY_SCOPES_VERSION_MINOR == 6 && UNITY_SCOPES_VERSION_MICRO < 10))
 
60
    std::string errorMessage = "SearchReply.PushFilters() is only available when compiled against libunity-scopes >= 0.6.10";
 
61
    *error = strdup(errorMessage.c_str());
 
62
    std::cerr << errorMessage << std::endl;
 
63
#else
57
64
    try {
58
65
        Variant filters_var = Variant::deserialize_json(from_gostring(filters_json));
59
66
        Variant filter_state_var = Variant::deserialize_json(from_gostring(filter_state_json));
66
73
    } catch (const std::exception &e) {
67
74
        *error = strdup(e.what());
68
75
    }
 
76
#endif
69
77
}
70
78
 
71
79
void init_preview_reply_ptr(SharedPtrData dest, SharedPtrData src) {