binding/v8/jsi/dataaccess/DateTimeProperty.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file DateTimeProperty.cpp
22 
23  \brief Utility functions to register the DateTimeProperty class into the Google JavaScript V8 engine.
24  */
25 
26 // TerraLib
27 #include "../../../../dataaccess/property/DateTimeProperty.h"
28 #include "../../common/Utils.h"
29 #include "DataAccess.h"
30 
31 // Boost
32 #include <boost/cstdint.hpp>
33 
34 ::v8::Handle<::v8::Value> DateTimeProperty_GetSubType(const ::v8::Arguments& args)
35 {
36  return ::v8::Undefined();
37 }
38 
39 ::v8::Handle<::v8::Value> DateTimeProperty_SetSubType(const ::v8::Arguments& args)
40 {
41  return ::v8::Undefined();
42 }
43 
44 ::v8::Handle<::v8::Value> DateTimeProperty_Clone(const ::v8::Arguments& args)
45 {
46  return ::v8::Undefined();
47 }
48 
49 ::v8::Handle<::v8::Value> DateTimeProperty_Constructor(const ::v8::Arguments& args)
50 {
51  //::v8::HandleScope hs;
52 
53  //if(!args.IsConstructCall())
54  // return ::v8::ThrowException(::v8::String::New("In order to create a check constraint, you need to call its constructor like: var c = new TeDateTimeProperty(dt, id);"));
55 
56  //if(args.Holder().IsEmpty())
57  // return ::v8::ThrowException(::v8::String::New("The DateTimeProperty constructor must use object notation!"));
58 
59  //if(args.Length() != 0)
60  // return ::v8::ThrowException(::v8::String::New("The DateTimeProperty constructor has no parameters!"));
61 
62  //std::auto_ptr<te::da::DateTimeProperty> catalog(new te::da::DateTimeProperty());
63 
64  //::v8::Local<::v8::Object> jcatalog = te::v8::common::Make(catalog.get(), te::v8::jsi::GetDateTimePropertyTemplate, true);
65 
66  //catalog.release();
67 
68  //return hs.Close(jcatalog);
69 
70  return ::v8::Undefined();
71 }
72 
73 void te::v8::jsi::RegisterDateTimeProperty(::v8::Local<::v8::Object>& global)
74 {
75  ::v8::Local<::v8::FunctionTemplate> jdatetimeproperty = ::v8::FunctionTemplate::New(DateTimeProperty_Constructor);
76 
77  global->Set(::v8::String::New("TeDateTimeProperty"), jdatetimeproperty->GetFunction());
78 }
79 
80 static ::v8::Persistent<::v8::FunctionTemplate> sdset_datetimeproperty_template;
81 
82 ::v8::Persistent<::v8::FunctionTemplate>& te::v8::jsi::GetDateTimePropertyTemplate()
83 {
85  {
86  ::v8::Persistent<::v8::FunctionTemplate>& pTpl = GetSimplePropertyTemplate();
87  ::v8::Local<::v8::FunctionTemplate> result = ::v8::FunctionTemplate::New();
88  result->Inherit(pTpl);
89 
90  ::v8::Handle<::v8::ObjectTemplate> prototype = result->PrototypeTemplate();
91 
92  prototype->Set(::v8::String::NewSymbol("getSubType"), ::v8::FunctionTemplate::New(DateTimeProperty_GetSubType));
93  prototype->Set(::v8::String::NewSymbol("setSubtype"), ::v8::FunctionTemplate::New(DateTimeProperty_GetSubType));
94  prototype->Set(::v8::String::NewSymbol("clone"), ::v8::FunctionTemplate::New(DateTimeProperty_Clone));
95 
96  sdset_datetimeproperty_template = ::v8::Persistent<::v8::FunctionTemplate>::New(result);
97  }
98 
100 }
::v8::Persistent<::v8::FunctionTemplate > & GetSimplePropertyTemplate()
It returns a reference to the persistent template of a SimpleProperty object.
::v8::Handle<::v8::Value > DateTimeProperty_GetSubType(const ::v8::Arguments &args)
JavaScript exporting routine for the TerraLib Data Access module.
static::v8::Persistent<::v8::FunctionTemplate > sdset_datetimeproperty_template
::v8::Persistent<::v8::FunctionTemplate > & GetDateTimePropertyTemplate()
It returns a reference to the persistent template of a DateTimeProperty object.
void RegisterDateTimeProperty(::v8::Local<::v8::Object > &global)
It registers the DateTimeProperty class.
::v8::Handle<::v8::Value > DateTimeProperty_Constructor(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DateTimeProperty_SetSubType(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DateTimeProperty_Clone(const ::v8::Arguments &args)