RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
soa/types/js/id_js.h
00001 /* id_js.h                                                         -*- C++ -*-
00002    JS encoding/decoding for IDs.
00003 */
00004 
00005 #pragma once
00006 
00007 #include "soa/js/js_utils.h"
00008 #include "soa/types/id.h"
00009 
00010 namespace Datacratic {
00011 
00012 class Id;
00013 
00014 namespace JS {
00015 
00016 inline void to_js(JS::JSValue & value, const Id & id)
00017 {
00018     to_js(value, id.toString());
00019 }
00020 
00021 inline Id from_js(const JSValue & value, Id * = 0)
00022 {
00023     std::string s;
00024     s = from_js(value, (std::string *)0);
00025     return Id(s);
00026 }
00027 
00028 inline Id from_js_ref(const JSValue & value, Id * = 0)
00029 {
00030     return from_js(value, (Id *)0);
00031 }
00032 
00033 } // namespace JS
00034 } // namespace Datacratic
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator