JabberIqRegister::JabberIqRegister(void) {
  Namespace("jabber:iq:register");
  Type("get");
  m_username = NULL;
  m_password = NULL;
  m_email = NULL;
}
Exemplo n.º 2
0
    bool DBClientWithCommands::ensureIndex( const string &ns , BSONObj keys , bool unique, const string & name ) {
        BSONObjBuilder toSave;
        toSave.append( "ns" , ns );
        toSave.append( "key" , keys );

        string cacheKey(ns);
        cacheKey += "--";

        if ( name != "" ) {
            toSave.append( "name" , name );
            cacheKey += name;
        }
        else {
            string nn = genIndexName( keys );
            toSave.append( "name" , nn );
            cacheKey += nn;
        }
        
        if ( unique )
            toSave.appendBool( "unique", unique );

        if ( _seenIndexes.count( cacheKey ) )
            return 0;
        _seenIndexes.insert( cacheKey );

        insert( Namespace( ns.c_str() ).getSisterNS( "system.indexes"  ).c_str() , toSave.obj() );
        return 1;
    }
MNcdLoadNodeOperation* CNcdSearchNodeBundleProxy::LoadChildrenL( TInt aIndex, 
                                                           TInt aSize,
                                                           TNcdChildLoadMode aMode,
                                                           MNcdLoadNodeOperationObserver& aObserver )
    {
    DLTRACEIN((("this: %X"), this));
    DASSERT( iSearchFilter );
        
    if( aSize < 1 || aIndex < 0 || ( aMode == ELoadMetadata && aIndex + aSize > ChildCount() ))
        {
        // Nothing to be done 
        DLERROR(( "Argument error. ChildCount: %d Given index: %d, size: %d",
                  ChildCount(), aIndex, aSize ));
        DASSERT( EFalse );
        User::Leave( KErrArgument );
        }

    DLTRACE(( _L("Node: %S, %S"), &Namespace(), &Id() ));

    // Search bundle may contain transparent stuff, so use server child count for loading
    // to get correct indexing on server side.
    return CNcdSearchNodeFolderProxy::LoadChildrenL( 
        0,
        ServerChildCount(),
        aMode,
        aObserver );
    }
CSenElement* CSenPropertiesElement::CreateElementL(const TDesC8& aNsPrefix,
                                                   const TDesC8& aLocalName)
    {
    CSenElement* pNewElement = NULL;

    if (aNsPrefix.Length() > 0)
        {
        CSenNamespace* pNamespace = (CSenNamespace*)Namespace(aNsPrefix);
        if (pNamespace)
            {
            HBufC8 *pQName =
                HBufC8::NewLC(aNsPrefix.Length() + aLocalName.Length() +5);
            TPtr8 ptr = pQName->Des();
            ptr.Append(aNsPrefix);
            ptr.Append(':');
            ptr.Append(aLocalName);
            pNewElement = CSenPropertiesElement::NewL(pNamespace->URI(),
                                                      aLocalName,
                                                      *pQName,
                                                      ipStringPool);
                                                      
            CleanupStack::PopAndDestroy(); // pQName
            }
        }
    else
        {
        pNewElement = CSenPropertiesElement::NewL(aLocalName, ipStringPool);
        }

    return pNewElement; // Returns NULL if required namespace can not be found!
    }
Exemplo n.º 5
0
void _ELC_::Project :: addSource(_ELENA_::path_t path)
{
   _ELENA_::Path modulePath;
   _ELENA_::ReferenceNs name(Namespace());

   // build module namespace
   modulePath.copySubPath(path);
   name.pathToName(modulePath.c_str());

   int key = 0;
   for (_ELENA_::SourceIterator it = _sources.start(); !it.Eof(); it++) {
      _ELENA_::ident_t currentName = _sources.get(it.key(), ELC_NAMESPACE_KEY, DEFAULT_STR);
      if (currentName.compare(name)) {
         key = it.key();
         break;
      }

   }
   if (key == 0) {
      key = _sources.Count() + 1;

      _sources.add(key, ELC_NAMESPACE_KEY, name.ident().clone());
   }

   _sources.add(key, ELC_INCLUDE, _ELENA_::IdentifierString::clonePath(path));
}
MNcdNode* CNcdSearchNodeBundleProxy::ChildL( TInt aIndex )
    {
    DLTRACEIN(( _L("This parent: %S, %S"), &Namespace(), &Id() ));

           
    if ( aIndex < 0 || aIndex >= iChildren.Count() )
        {
        // Nothing to be done 
        DLERROR(( "Index error. child count: %d Given index: %d", 
                  iChildren.Count(), aIndex ));
        DASSERT( EFalse );
        User::Leave( KErrArgument );
        }
        
    const CNcdNodeIdentifier* child = &iChildren[aIndex]->Identifier();
        
    MNcdNode* node( NULL );
    
    TRAPD( err, node = &NodeManager().NodeL( *child ) );
    
    if ( err == KErrNotFound ) 
        {
        return NULL;
        }
        
    User::LeaveIfError( err );
    
    // Increase the reference counter by one
    node->AddRef();
    
    DLTRACEOUT((""));

    return node;
    }
Exemplo n.º 7
0
wxString PHPSourceFile::MakeIdentifierAbsolute(const wxString& type)
{
    wxString typeWithNS(type);
    typeWithNS.Trim().Trim(false);

    if(typeWithNS == "string" || typeWithNS == "array" || typeWithNS == "mixed" || typeWithNS == "bool" ||
        typeWithNS == "int" || typeWithNS == "integer" || typeWithNS == "boolean" || typeWithNS == "double") {
        // primitives, don't bother...
        return typeWithNS;
    }

    if(typeWithNS.IsEmpty()) return "";

    // A fully qualified type? don't touch it
    if(typeWithNS.StartsWith("\\")) {
        return typeWithNS;
    }

    // Handle 'use' cases:
    // use Zend\Form; // create an alias entry: Form => Zend\Form
    // class A extends Form\Form {}
    // The extends should be expanded to Zend\Form\Form
    if(typeWithNS.Contains("\\")) {
        wxString scopePart = typeWithNS.BeforeLast('\\');
        wxString className = typeWithNS.AfterLast('\\');
        if(m_aliases.find(scopePart) != m_aliases.end()) {
            typeWithNS.clear();
            typeWithNS << m_aliases.find(scopePart)->second << "\\" << className;
            // Remove duplicate NS separators
            typeWithNS.Replace("\\\\", "\\");
            if(!typeWithNS.StartsWith("\\")) {
                typeWithNS << "\\";
            }
            return typeWithNS;
        }
    }

    // If the symbol contains namespace separator
    // Convert it full path and return (prepend namespace separator)
    if(typeWithNS.Contains("\\")) {
        if(!typeWithNS.StartsWith("\\")) {
            typeWithNS.Prepend("\\");
        }
        return typeWithNS;
    }

    // Use the alias table first
    if(m_aliases.find(type) != m_aliases.end()) {
        return m_aliases.find(type)->second;
    }

    wxString ns = Namespace()->GetFullName();
    if(!ns.EndsWith("\\")) {
        ns << "\\";
    }

    typeWithNS.Prepend(ns);
    return typeWithNS;
}
Exemplo n.º 8
0
void PHPSourceFile::PhaseTwo()
{
    // Visit each entity found during the parsing stage
    // and try to match it with its phpdoc comment block (we do this by line number)
    // the visitor also makes sure that each entity is properly assigned with the current file name
    PHPDocVisitor visitor(*this, m_comments);
    visitor.Visit(Namespace());
}
Exemplo n.º 9
0
	void UserScript::Delete ()
	{
		QSettings settings (QCoreApplication::organizationName (),
			QCoreApplication::applicationName () + "_Poshuku_FatApe");

		settings.remove (QString ("storage/%1/%2")
				.arg (qHash (Namespace ()))
				.arg (Name ()));
		settings.remove (QString ("resources/%1/%2")
				.arg (qHash (Namespace ()))
				.arg (Name ()));
		settings.remove (QString ("disabled/%1%2")
				.arg (qHash (Namespace ()))
				.arg (Name ()));
		Q_FOREACH (const QString& resource, Metadata_.values ("resource"))
			QFile::remove (GetResourcePath (resource.mid (0, resource.indexOf (" "))));
		QFile::remove (ScriptPath_);
	}
Exemplo n.º 10
0
        /**
         * Create temporary collection, set up indexes
         */
        void State::prepTempCollection() {
            if ( ! _onDisk )
                return;

            if (_config.incLong != _config.tempLong) {
                // create the inc collection and make sure we have index on "0" key
                _db.dropCollection( _config.incLong );
                {
                    writelock l( _config.incLong );
                    Client::Context ctx( _config.incLong );
                    string err;
                    if ( ! userCreateNS( _config.incLong.c_str() , BSON( "autoIndexId" << 0 ) , err , false ) ) {
                        uasserted( 13631 , str::stream() << "userCreateNS failed for mr incLong ns: " << _config.incLong << " err: " << err );
                    }
                }

                BSONObj sortKey = BSON( "0" << 1 );
                _db.ensureIndex( _config.incLong , sortKey );
            }

            // create temp collection
            _db.dropCollection( _config.tempLong );
            {
                writelock lock( _config.tempLong.c_str() );
                Client::Context ctx( _config.tempLong.c_str() );
                string errmsg;
                if ( ! userCreateNS( _config.tempLong.c_str() , BSONObj() , errmsg , true ) ) {
                    uasserted( 13630 , str::stream() << "userCreateNS failed for mr tempLong ns: " << _config.tempLong << " err: " << errmsg );
                }
            }

            {
                // copy indexes
                auto_ptr<DBClientCursor> idx = _db.getIndexes( _config.finalLong );
                while ( idx->more() ) {
                    BSONObj i = idx->next();

                    BSONObjBuilder b( i.objsize() + 16 );
                    b.append( "ns" , _config.tempLong );
                    BSONObjIterator j( i );
                    while ( j.more() ) {
                        BSONElement e = j.next();
                        if ( str::equals( e.fieldName() , "_id" ) ||
                                str::equals( e.fieldName() , "ns" ) )
                            continue;

                        b.append( e );
                    }

                    BSONObj indexToInsert = b.obj();
                    insert( Namespace( _config.tempLong.c_str() ).getSisterNS( "system.indexes" ).c_str() , indexToInsert );
                }

            }

        }
Exemplo n.º 11
0
	void UserScript::SetEnabled (bool value)
	{
		QSettings settings (QCoreApplication::organizationName (),
			QCoreApplication::applicationName () + "_Poshuku_FatApe");

		settings.setValue (QString ("disabled/%1%2")
			.arg (qHash (Namespace ()))
			.arg (qHash (Name ())), !value);
		Enabled_ = value;

	}
JabberIqRegister::JabberIqRegister(const std::string &username, const std::string &password, const std::string &email) {
  Namespace("jabber:iq:register");
  Type("set");
  m_username = new std::string(username);
  m_password = new std::string(password);
  if ("" != email) {
    m_email = new std::string(email);
  }
  else {
    m_email = NULL;
  }
}
Exemplo n.º 13
0
MNcdNode* CNcdNodeFolderProxy::ChildL( TInt aIndex )
    {
    DLTRACEIN(( _L("This parent: %S, %S"), &Namespace(), &Id(), aIndex ));
    DLINFO(("aIndex = %d, expected childcount= %d, real child count = %d",
        aIndex, iExpectedChildCount, iChildren.Count() ));
        
    if ( aIndex < 0 || aIndex >= iExpectedChildCount )
        {
        // Nothing to be done 
        DLERROR(( "Index error. expected child count: %d Given index: %d", 
                  iExpectedChildCount, aIndex ));
        DASSERT( EFalse );
        User::Leave( KErrArgument );   
        }
        
    // search for a child with given index
    const CNcdNodeIdentifier* child = NULL;
    for( TInt i = 0 ; i < iChildren.Count() ; i++ )
        {
        if ( iChildren[i]->Index() == aIndex )
            {
            child = &iChildren[i]->Identifier();
            }
        else if ( iChildren[i]->Index() > aIndex )
            {
            // no sense in searching further
            break;
            }
        }

    if( child == NULL )
        {
        return NULL;
        }
    
    MNcdNode* node( NULL );
    
    TRAPD( err, node = &NodeManager().NodeL( *child ) );    

    if ( err == KErrNotFound ) 
        {
        return NULL;
        }

    User::LeaveIfError( err );
    
    // Increase the reference counter by one
    node->AddRef();
    
    DLTRACEOUT((""));

    return node;
    }
MNcdLoadNodeOperation* CNcdSearchNodeFolderProxy::LoadChildrenL( TInt aIndex, 
                                                           TInt aSize,
                                                           TNcdChildLoadMode aMode,
                                                           MNcdLoadNodeOperationObserver& aObserver )
    {
    DLTRACEIN((("this: %X"), this));
    DASSERT( iSearchFilter );
    
    if( aSize < 1 || aIndex < 0 || ( aMode == ELoadMetadata && aIndex + aSize > ChildCount() ))
        {
        // Nothing to be done 
        DLERROR(( "Argument error. ChildCount: %d Given index: %d, size: %d",
                  ChildCount(), aIndex, aSize ));
        DASSERT( EFalse );
        User::Leave( KErrArgument );
        }

    DLTRACE(( _L("Node: %S, %S"), &Namespace(), &Id() ));

    #ifdef CATALOGS_BUILD_CONFIG_DEBUG    
    const MDesCArray& keywords = iSearchFilter->Keywords();
    DLINFO(("Search filter: "));
    for ( TInt i = 0; i < keywords.MdcaCount(); i++ ) 
        {
        DLINFO((_L("%S"), &keywords.MdcaPoint( i ) ));
        }
    #endif
        
    CNcdLoadNodeOperationProxy* operation = 
        OperationManager().CreateLoadNodeOperationL( *this,
            ETrue, // load children
            aSize, 
            aIndex,
            1,
            aMode,
            iSearchFilter );

    if( operation == NULL )
        {
        DLTRACEOUT(("NULL"));     
        return NULL;
        }

    CleanupReleasePushL( *operation );
    operation->AddObserverL( this );
    operation->AddObserverL( &aObserver );
    CleanupStack::Pop( operation );
    
    DLTRACEOUT((""));

    return operation;
    }
Exemplo n.º 15
0
void CNcdNodeFolderProxy::InternalizeNodeLinkDataL( RReadStream& aStream )
    {
    DLTRACEIN(( _L("Node: %S, %S"), &Namespace(), &Id() ));
    
    // First internalize parent data
    CNcdNodeProxy::InternalizeNodeLinkDataL( aStream );

    // Then, set the data for this class object
    
    iExpectedChildCount = aStream.ReadInt32L();

    DLTRACEOUT((""));
    }
Exemplo n.º 16
0
MNcdLoadNodeOperation* CNcdNodeFolderProxy::LoadChildrenL( TInt aIndex, 
                                                           TInt aSize,
                                                           TNcdChildLoadMode aMode,
                                                           MNcdLoadNodeOperationObserver& aObserver )
    {
    DLTRACEIN(("aIndex: %d, aSize: %d, expected child count: %d, load mode: %d",
        aIndex, aSize, iExpectedChildCount, aMode ));

    if ( aSize < 1 
         || aIndex < 0 
         || ( aMode == ELoadMetadata 
              && aSize != KMaxTInt 
              && aIndex + aSize > ChildCount() ) )
        {
        // Nothing to be done 
        DLERROR(( "Argument error. ChildCount: %d Given index: %d, size: %d",
                  ChildCount(), aIndex, aSize ));
        User::Leave( KErrArgument );
        }

    if ( aSize == KMaxTInt )
        {
        // Because aSize is KMaxTInt, reduce it by the aIndex value.
        // This way we will not have possible overload if aIndex is later added
        // to the aSize value. It does not really matter what the aSize value is
        // after this. KMaxTInt is so great value, that in all the cases the server
        // request should give all the required items.
        aSize -= aIndex;
        DLINFO(("aSize was KMaxTInt. Reduced by index: %d", aSize));
        }

    DLTRACE(( _L("Node: %S, %S"), &Namespace(), &Id() ));
    
    CNcdLoadNodeOperationProxy* operation = 
        OperationManager().CreateLoadNodeOperationL( 
            *this, ETrue, aSize, aIndex, 1, aMode );

    if ( !operation )
        {
        DLTRACEOUT(("NULL"));     
        return NULL;
        }

    operation->AddObserverL( this );
    operation->AddObserverL( &aObserver );

    DLTRACEOUT((""));        

    return operation;
    }
const std::string *JabberIqRegister::render(const std::string *id) const {
  std::ostringstream body;

  if (NULL != m_username) {
    body << "<username>" << *m_username << "</username>";
  }
  if (NULL != m_password) {
    body << "<password>" << *m_password << "</password>";
  }
  if (NULL != m_email) {
    body << "<email>" << *m_email << "</email>";
  }
  return renderIqStanza(id, Namespace(), body.str());
}
Exemplo n.º 18
0
    void DBClientWithCommands::reIndex( const string& ns ) {
        list<BSONObj> all;
        auto_ptr<DBClientCursor> i = getIndexes( ns );
        while ( i->more() ) {
            all.push_back( i->next().getOwned() );
        }

        dropIndexes( ns );

        for ( list<BSONObj>::iterator i=all.begin(); i!=all.end(); i++ ) {
            BSONObj o = *i;
            insert( Namespace( ns.c_str() ).getSisterNS( "system.indexes" ).c_str() , o );
        }

    }
Exemplo n.º 19
0
void CNcdNodeFolderProxy::InternalizeNodeDataL( RReadStream& aStream )
    {
    DLTRACEIN((""));
    
    // First internalize parent data
    CNcdNodeProxy::InternalizeNodeDataL( aStream );

    // Get the children data here.

    DLTRACE(("Handle children"));

    // Clear the buffer because new childs will be appended
    iChildren.ResetAndDestroy();
    
    TInt childrenCount( aStream.ReadInt32L() );
    DLTRACE(("Children: %d", childrenCount ));

    TInt classObjectType( NcdNodeClassIds::ENcdNullObjectClassId );

    for ( TInt i = 0; i < childrenCount; ++i )
        {
        // This is safe casting because enum is same as TInt
        classObjectType = 
            static_cast<NcdNodeClassIds::TNcdNodeClassId>(aStream.ReadInt32L());
        if ( NcdNodeClassIds::ENcdChildEntityClassId == classObjectType )
            {
            CNcdChildEntity* childEntity = CNcdChildEntity::NewLC( aStream );
            iChildren.AppendL( childEntity );
            CleanupStack::Pop( childEntity );            
            DLINFO((_L("Added child, id: %S, array index: %d, real index: %d"),
            &childEntity->Identifier().NodeId(), i, childEntity->Index() ));
            }
        else
            {
            // For debug purposes
            DLERROR(("Wrong class id"));
            DASSERT( EFalse );

            // Wrong kind of class object info
            User::Leave( KErrCorrupt );
            }
        }
        
    // Show node info here, after the internalization has been done.        
    DLTRACEOUT(( _L("Node: %S, %S, %d"), 
                 &Namespace(), &Id(), NodeIdentifier().ClientUid().iUid ));
    }
Exemplo n.º 20
0
    bool DBClientBase::ensureIndex( const string &ns , BSONObj keys , bool unique, const string & name ) {
        BSONObjBuilder toSave;
        toSave.append( "ns" , ns );
        toSave.append( "key" , keys );

        string cacheKey(ns);
        cacheKey += "--";

        if ( name != "" ) {
            toSave.append( "name" , name );
            cacheKey += name;
        }
        else {
            stringstream ss;
            
            bool first = 1;
            for ( BSONObjIterator i(keys); i.more(); ) {
                BSONElement f = i.next();

                if ( first )
                    first = 0;
                else
                    ss << "_";

                ss << f.fieldName() << "_";

                if ( f.type() == NumberInt )
                    ss << (int)(f.number() );
                else if ( f.type() == NumberDouble )
                    ss << f.number();

            }

            toSave.append( "name" , ss.str() );
            cacheKey += ss.str();
        }
        
        if ( unique )
            toSave.appendBool( "unique", unique );

        if ( _seenIndexes.count( cacheKey ) )
            return 0;
        _seenIndexes.insert( cacheKey );

        insert( Namespace( ns.c_str() ).getSisterNS( "system.indexes"  ).c_str() , toSave.obj() );
        return 1;
    }
Exemplo n.º 21
0
	QString UserScript::GetResourcePath (const QString& resourceName) const
	{
		const QString& resource = QStringList (Metadata_.values ("resource"))
				.filter (QRegExp (QString ("%1\\s.*").arg (resourceName)))
				.value (0)
				.mid (resourceName.length ())
				.trimmed ();
		QUrl resourceUrl (resource);
		const QString& resourceFile = QFileInfo (resourceUrl.path ()).fileName ();
		
		return resourceFile.isEmpty () ? 
			QString () :
			QFileInfo (Util::CreateIfNotExists ("data/poshuku/fatape/scripts/resources"),
				QString ("%1%2_%3")
					.arg (qHash (Namespace ()))
					.arg (qHash (Name ()))
					.arg (resourceFile)).absoluteFilePath ();		
	}
Exemplo n.º 22
0
void ISymbol::DeepCopy(ISymbolPtr c)
{
	c->Name()=Name();

	c->Abstract() = Abstract();
	c->Atomic() = Atomic();
	c->Attributes() = Attributes();
	c->BaseTypeName() = BaseTypeName();
	c->Compositor() = Compositor();
	c->DerivedType() = DerivedType();
	c->Dimension() = Dimension();
	c->Enumerations() = Enumerations();
	c->FacetKinds() = FacetKinds();
	c->Facets() = Facets();
	c->Global() = Global();
	c->Level() = Level();
	c->List() = List();
	c->ListSize() = ListSize();
	c->ListType() = ListType();
	c->LowerBounds() = LowerBounds();
	c->Namespace() = Namespace();
	c->Optional() = Optional();
	c->OuterElementName() = OuterElementName();
	c->OuterElementTypeName() = OuterElementTypeName();
	c->Parent() = Parent();
	c->Parsed() = Parsed();
	c->PrimitiveType() = PrimitiveType();
	c->Required() = Required();
	c->SimpleContent() = SimpleContent();
	c->SimpleType() = SimpleType();
	c->SqlCount() = SqlCount();
	c->SqlType() = SqlType();
	c->SubstitutionGroupAffiliation() = SubstitutionGroupAffiliation();
	c->SubstitutionList() = SubstitutionList();
	c->SubTypes() = SubTypes();
	c->SuperTypes() =  SuperTypes();
	c->Type() = Type();
	c->TypeName() = TypeName();
	c->UpperBounds() = UpperBounds();
	c->Variable() = Variable();
	c->Visited() = Visited();
	c->XercesType() = XercesType();
}
MNcdNode::TState CNcdSearchNodeFolderProxy::State() const
    {
    DLTRACEIN((_L("Node namespace=%S, id=%S"), &Namespace(), &Id() ));

    // Check if the link handle has been set, which means that also
    // link data has been internalized. Also, check if the metadata 
    // exists, which means that metadata has also been internalized.
    if ( LinkHandleSet() 
         && Metadata() != NULL )
        {        
        DLTRACEOUT(("Initialized"));
        return MNcdNode::EStateInitialized;
        }
     else
        {
        // Node has not been initialized.
        DLTRACEOUT(("Not initialized"));
        return MNcdNode::EStateNotInitialized;
        }
    }
Exemplo n.º 24
0
Arquivo: mr.cpp Projeto: pdex/mongo
        void State::prepTempCollection() {
            if ( ! _onDisk )
                return;

            _db.dropCollection( _config.tempLong );

            {
                // create
                writelock lock( _config.tempLong.c_str() );
                Client::Context ctx( _config.tempLong.c_str() );
                string errmsg;
                assert( userCreateNS( _config.tempLong.c_str() , BSONObj() , errmsg , true ) );
            }


            {
                // copy indexes
                auto_ptr<DBClientCursor> idx = _db.getIndexes( _config.finalLong );
                while ( idx->more() ) {
                    BSONObj i = idx->next();

                    BSONObjBuilder b( i.objsize() + 16 );
                    b.append( "ns" , _config.tempLong );
                    BSONObjIterator j( i );
                    while ( j.more() ) {
                        BSONElement e = j.next();
                        if ( str::equals( e.fieldName() , "_id" ) ||
                                str::equals( e.fieldName() , "ns" ) )
                            continue;

                        b.append( e );
                    }

                    BSONObj indexToInsert = b.obj();
                    insert( Namespace( _config.tempLong.c_str() ).getSisterNS( "system.indexes" ).c_str() , indexToInsert );
                }

            }

        }
Exemplo n.º 25
0
bool
SCOCacheMountPoint::empty_()
{
    VERIFY(fs::exists(path_));

    if (fs::exists(lockFilePath_()))
    {
        return false;
    }

    fs::directory_iterator end;

    for (fs::directory_iterator it(path_); it != end; ++it)
    {
        if (validateNamespace_(Namespace(it->path().filename().string())))
        {
            return false;
        }
    }

    return true;
}
Exemplo n.º 26
0
	void UserScript::Inject (QWebFrame *frame, IProxyObject *proxy) const
	{
		if (!Enabled_)
			return;
		
		QFile script (ScriptPath_);

		if (!script.open (QFile::ReadOnly))
		{
			qWarning () << Q_FUNC_INFO
				<< "unable to open file"
				<< script.fileName ()
				<< "for reading:"
				<< script.errorString ();
			return;
		}

		QTextStream content (&script);
		QString gmLayerId = QString ("Greasemonkey%1%2")
				.arg (qHash (Namespace ()))
				.arg (qHash (Name ()));
		QString toInject = QString ("(function (){"
			"var GM_addStyle = %1.addStyle;"
			"var GM_deleteValue = %1.deleteValue;"
			"var GM_getValue = %1.getValue;"
			"var GM_listValues = %1.listValues;"
			"var GM_setValue = %1.setValue;"
			"var GM_openInTab = %1.openInTab;"
			"var GM_getResourceText = %1.getResourceText;"
			"var GM_getResourceURL = %1.getResourceURL;"
			"var GM_log = function(){console.log.apply(console, arguments)};"
			"%2})()")
				.arg (gmLayerId)
				.arg (content.readAll ());

		frame->addToJavaScriptWindowObject (gmLayerId, 
				new GreaseMonkey (frame, proxy, *this));
		frame->evaluateJavaScript (toInject);
	}
Exemplo n.º 27
0
MNcdNode::TState CNcdNodeProxy::State() const
    {
    DLTRACEIN((_L("Node namespace=%S, id=%S"), &Namespace(), &Id() ));

    // Check if the link handle has been set, which means that also
    // link data has been internalized. Also, check if the metadata 
    // exists, which means that metadata has also been internalized.
    if ( LinkHandleSet() 
         && iMetadata != NULL )
        {
        DLINFO(("State was initialized"));
        // If state was initialized we have to check if the state
        // has acutally expired already 
        TTime now;
        now.HomeTime();

        DLINFO(("now time: %d", now.Int64() ));
        DLINFO(("expired time: %d", ExpiredTime().Int64() ));

        // We can just compare the times here. Server side
        // inserts the maximum value for the expired time if the
        // protocol has set never expire value for the validity delta.
        if ( now > ExpiredTime() )
            {
            DLTRACEOUT(("Expired"));
            return MNcdNode::EStateExpired;
            }
            
        DLTRACEOUT(("Initialized"));
        return MNcdNode::EStateInitialized;
        }
     else
        {
        // Node has not been initialized.
        DLTRACEOUT(("Not initialized"));
        return MNcdNode::EStateNotInitialized;
        }
    }
Exemplo n.º 28
0
wxString PHPSourceFile::MakeIdentifierAbsolute(const wxString& type)
{
    wxString typeWithNS(type);
    typeWithNS.Trim().Trim(false);

    if(typeWithNS == "string" || typeWithNS == "array" || typeWithNS == "mixed" || typeWithNS == "bool" ||
       typeWithNS == "int" || typeWithNS == "integer" || typeWithNS == "boolean" || typeWithNS == "double") {
        // primitives, don't bother...
        return typeWithNS;
    }

    if(typeWithNS.IsEmpty()) return "";
    // If the symbol contains namespace separator
    // Convert it full path and return (prepend namespace separator)
    if(typeWithNS.Contains("\\")) {
        if(!typeWithNS.StartsWith("\\")) {
            typeWithNS.Prepend("\\");
        }
        return typeWithNS;
    }

    if(typeWithNS.StartsWith("\\")) {
        return typeWithNS;
    }

    // Use the alias table first
    if(m_aliases.find(type) != m_aliases.end()) {
        return m_aliases.find(type)->second;
    }

    wxString ns = Namespace()->GetFullName();
    if(!ns.EndsWith("\\")) {
        ns << "\\";
    }

    typeWithNS.Prepend(ns);
    return typeWithNS;
}
Exemplo n.º 29
0
void _ELC_::Project :: addModule(_ELENA_::_ConfigFile::Node moduleNode)
{
   _ELENA_::ReferenceNs name(Namespace());

   name.combine(moduleNode.Attribute(ELC_NAME_KEY));

   int key = _sources.Count() + 1;
   _sources.add(key, ELC_NAMESPACE_KEY, name.ident().clone());

   _ELENA_::ident_t targetAttr = moduleNode.Attribute(ELC_TARGET_NAME);
   if (!_ELENA_::emptystr(targetAttr)) {
      _sources.add(key, ELC_TARGET_NAME, targetAttr.clone());
   }

   _ELENA_::_ConfigFile::Nodes list;
   moduleNode.select(ELC_INCLUDE, list);

   for (_ELENA_::_ConfigFile::Nodes::Iterator it = list.start(); !it.Eof(); it++) {
      _ELENA_::ident_t file = (*it).Content();

      _sources.add(key, ELC_INCLUDE, file.clone());
   }
}
status_t
InterfaceRec::View()
{
	bout << "ID = " << ID() << endl;
	bout << "Namespace = " << Namespace() << endl;
	
	SVector<SString> rents=Parents();
	for (int s=0; s<rents.CountItems(); s++) { 	
		if (s=0) {
			bout << "Parents = " << endl;
		}
		bout << " - " << rents.ItemAt(s) << endl;
	}

	int32_t num=CountProperties();
	bout << "# of Properties = " << num << endl;
	for (int s=0; s< num; s++) {
		sptr<IDLNameType> nt=PropertyAt(s);
		bout << " - " << nt->m_id << endl;
	}
	
	num=CountMethods();
	bout << "# of Methods = " << num << endl;
	for (int s=0; s< num; s++) {
		sptr<IDLMethod> m=MethodAt(s);
		bout << " - " << m->ID() << endl;
	}

	num=CountEvents();
	bout << "# of Events = " << num << endl;
	for (int s=0; s< CountEvents(); s++) {
		sptr<IDLEvent> e=EventAt(s);
		bout << " - " << e->ID() << endl;
	}
	return B_OK;
}