0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

more v8 work

This commit is contained in:
Eliot Horowitz 2009-10-12 11:22:30 -04:00
parent b4f18042ef
commit bd840cf7b0
2 changed files with 16 additions and 4 deletions

View File

@ -69,6 +69,19 @@ namespace mongo {
_global->Set( v8::String::New( field ) , v8::Boolean::New( val ) );
}
void V8Scope::setElement( const char *field , const BSONElement& e ){
_global->Set( v8::String::New( field ) , mongoToV8Element( e ) );
}
void V8Scope::setObject( const char *field , const BSONObj& obj , bool readOnly){
// TODO: ignoring readOnly
_global->Set( v8::String::New( field ) , mongoToV8( obj ) );
}
void V8Scope::setThis( const BSONObj * obj ){
_this = mongoToV8( *obj );
}
double V8Scope::getNumber( const char *field ){
return _global->Get( v8::String::New( field ) )->ToNumber()->Value();
}
@ -116,7 +129,6 @@ namespace mongo {
}
Handle<Value> f = _global->Get( v8::String::New( fn.c_str() ) );
cout << "HERE : " << f << endl;
uassert( "not a func" , f->IsFunction() );
_funcs.push_back( f );
return num;

View File

@ -32,9 +32,9 @@ namespace mongo {
virtual void setNumber( const char *field , double val );
virtual void setString( const char *field , const char * val );
virtual void setBoolean( const char *field , bool val );
virtual void setElement( const char *field , const BSONElement& e ){ assert( 0 );}
virtual void setObject( const char *field , const BSONObj& obj , bool readOnly){ assert(0); }
virtual void setThis( const BSONObj * obj ){ assert(0); }
virtual void setElement( const char *field , const BSONElement& e );
virtual void setObject( const char *field , const BSONObj& obj , bool readOnly);
virtual void setThis( const BSONObj * obj );
virtual ScriptingFunction _createFunction( const char * code );
virtual int invoke( ScriptingFunction func , const BSONObj& args, int timeoutMs = 0 , bool ignoreReturn = false );