示例#1
0
BOOL ON_UserData::IsValid( ON_TextLog* text_log ) const
{
  if ( 0 == ON_UuidCompare( &m_userdata_uuid, &ON_nil_uuid ) )
  {
    if ( 0 != text_log )
    {
      text_log->Print("invalid userdata - m_userdata_uuid = nil\n");
    }
    return false;
  }

  if ( 0 == ON_UuidCompare( m_userdata_uuid, ON_UserData::ClassId()->Uuid() ) )
  {
    if ( 0 != text_log )
    {
      text_log->Print("invalid userdata - m_userdata_uuid in use. Use guidgen to get a unique id.\n");
    }
    return false;
  }

  if ( Archive() && 0 == ON_UuidCompare( ClassId()->Uuid(), ON_UserData::ClassId()->Uuid() ) )
  {
    // 8 January 2004 Dale Lear:
    //  I added this test to help developers remember to use
    //  the ON_DECLARE_OBJECT/ON_IMPLEMENT_OBJECT macros when
    //  they create user data that gets archived.
    if ( 0 != text_log )
    {
      text_log->Print("invalid userdata - classes derived from ON_UserData that get saved in 3dm archives must have a class id and name defined by ON_OBJECT_DECLARE/ON_OBJECT_IMPLEMENT.\n");
    }
    return false;
  }

  return true;
}
void CNcdNodePreview::ExternalizeL( RWriteStream& aStream )
    {
    DLTRACEIN((""));

    // Set all the membervariable values to the stream. So,
    // that the stream may be used later to create a new
    // object.

    // First insert data that the creator of this class object will use to
    // create this class object. Class id informs what class object
    // will be created.
    
    aStream.WriteInt32L( ClassId() );
    
    aStream.WriteInt16L( iFileCount );
    
    for( int i = 0; i < iFileCount; i++ )
        {
        ExternalizeDesL( *iPreviewMimeTypes[i], aStream );
        }
    
    for( int i = 0; i < iFileCount; i++ )
        {
        ExternalizeDesL( *iUris[i], aStream );
        }
        
    DLTRACEOUT((""));
    }
示例#3
0
ON_UUID ON_UserData::UserDataClassUuid() const
{
  const ON_ClassId* cid = ClassId();
  return ( cid == &ON_UnknownUserData::m_ON_UnknownUserData_class_id )
          ? ((ON_UnknownUserData*)this)->m_unknownclass_uuid
          : cid->Uuid();
}
示例#4
0
ON_BOOL32 ON_Object::IsKindOf( const ON_ClassId* pBaseClassId ) const
{
  ON_BOOL32 b = false;
  const ON_ClassId* p = ClassId();
  if ( p )
    b = p->IsDerivedFrom( pBaseClassId );
  return b;
}
示例#5
0
void OOPMergeMatrix::Write(TPZStream & buf, int withclassid){
	OOPTask::Write(buf, withclassid);
	int clsid = ClassId();
	buf.Write(&clsid);
	buf.Write(&m_SubId, 1);
	cout << "m_SubId " << m_SubId << endl;
	cout.flush();
	m_Vector.Write(buf, 0);
	m_Vector.Print("Na tarefa Merge", cout, EFormatted);
	cout.flush();
}
示例#6
0
bool ON_Object::CopyFrom( const ON_Object* src )
{
  // In V6 this will be a virtual function that will be
  // declared in the ON_OBJECT_DECLARE macro and defined
  // in the ON_OBJECT_IMPLEMENT macro.  The check for
  // cid->ClassIdVersion() >= 1 is CRITICAL and it must
  // happen before looking at the cid->m_copy member.
  // See the comments in the ON_ClassId constructors for
  // details.
  const ON_ClassId* cid = ClassId();
  return (cid && cid->ClassIdVersion() >= 1 && cid->m_copy) ? cid->m_copy(src,this) : false;
}
示例#7
0
void OOPDouble::Read(TPZStream & buf, void * context){
	TPZSaveable::Read(buf, context);
	buf.Read(&fValue);
	int clsid=0;
	buf.Read(&clsid);
	if(clsid!=ClassId()){
#ifdef LOG4CXX
		std::stringstream sout;
		sout << "ClassId missmatch on OOPDouble::Read";
		LOGPZ_ERROR(logger,sout.str().c_str());
#endif
	}
}
示例#8
0
void OOPMergeMatrix::Read(TPZStream & buf, void * context){
	OOPTask::Read(buf, context);
	int clsid = 0;
	buf.Read(&clsid);
	if(ClassId()!=clsid){
		cout << "ClassId Missmatch\n";
	}
	buf.Read(&m_SubId, 1);
	cout << "m_SubId " << m_SubId << endl;
	cout.flush();
	m_Vector.Read(buf, 0);
	m_Vector.Print("Depois de lido" , cout, EFormatted);
	cout.flush();
}
示例#9
0
void ON_Object::Dump( ON_TextLog& dump ) const
{
  const ON_ClassId* p = ClassId();
  if ( p ) 
  {
    const char* class_name = p->ClassName();
    if ( 0 == class_name ) 
      class_name = "unknown";
    dump.Print("class name: %s\n",class_name);
    dump.Print("class uuid: ");
    dump.Print(p->Uuid());
    dump.Print("\n");
  }
  else 
  {
    dump.Print("ON_Object::ClassId() FAILED\n");
  }
}
void CNcdNodePreview::InternalizeL( RReadStream& aStream )
    {
    DLTRACEIN((""));

    // Read the class id first because it is set to the stream in internalize
    // function and it is not read from the stream anywhere else.
    TInt classId( aStream.ReadInt32L() );
    if ( classId != ClassId() )
        {
        DLERROR(("Wrong class id"));
        DASSERT( EFalse );
        // Leave because the stream does not match this class object
        User::Leave( KErrCorrupt );
        }
    
    iFileCount = aStream.ReadInt16L();

    HBufC* previewMimeType = 0;
    iPreviewMimeTypes.ResetAndDestroy();
    for( int i = 0; i < iFileCount; i++ )
        {
        InternalizeDesL( previewMimeType, aStream );
        CleanupStack::PushL( previewMimeType );
        iPreviewMimeTypes.AppendL( previewMimeType );
        CleanupStack::Pop( previewMimeType );
        }
        
    HBufC* uri = 0;
    iUris.ResetAndDestroy();
    for( int i = 0; i < iFileCount; i++ )
        {
        InternalizeDesL( uri, aStream );
        CleanupStack::PushL( uri );
        iUris.AppendL( uri );
        CleanupStack::Pop( uri );
        }
    
    // Try to update MIME from downloaded previews
    UpdateMimesFromPreviewManagerL();
    DLTRACEOUT((""));
    }
void CNcdNodePreview::ExternalizeDataForRequestL( RWriteStream& aStream )
    {
    DLTRACEIN((""));

    if ( IsObsolete() )
        {
        DLINFO(("Set as obsolete. This means that server has removed the object."));
        User::Leave( KNcdErrorObsolete );
        }

    aStream.WriteInt32L( ClassId() );
    
    aStream.WriteInt16L( iFileCount );

    for( int i = 0; i < iFileCount; i++ )
        {
        ExternalizeDesL( *iPreviewMimeTypes[i], aStream );
        }
    
    DLTRACEOUT((""));
    }
示例#12
0
void CNcdNodeLink::ExternalizeDataForRequestL( RWriteStream& aStream ) const
    {
    DLTRACEIN((""));

    // Link existed. So, insert info that link was found.
    aStream.WriteInt32L( ClassId() );

    // Notice that the proxy does not require all the information contained
    // in this class. So, send only the information that proxy wants.

    ExternalizeDesL( Timestamp(), aStream );
    ExternalizeDesL( CatalogsSourceName(), aStream );
    aStream.WriteInt32L( RemoteFlag() );
 
    aStream << ExpiredTime().Int64();    
        
    ParentIdentifierForRequestL( aStream );
    
    // Externalize the real parent too.
    ParentIdentifier().ExternalizeL( aStream );
        
    DLTRACEOUT((""));
    }
示例#13
0
 virtual bool WriteTo  (CL_Stream& s) const
     {return s.Write (ClassId()) && data.WriteTo (s);};
示例#14
0
void ON_ClassId::ConstructorHelper( const char* sClassName, 
                        const char* sBaseClassName, 
                        const char* sUUID // UUID in registry format from guidgen
                        ) 
{
  // Do not initialize "m_class_id_version" or any fields
  // after it in this helper.  See comments in the constructors
  // for more information.
  memset( m_sClassName, 0, sizeof(m_sClassName) );
  memset( m_sBaseClassName, 0, sizeof(m_sBaseClassName) );
  m_uuid = ON_UuidFromString(sUUID);
  if ( sClassName ) {
    strncpy( m_sClassName, sClassName, sizeof(m_sClassName)-1 );
  }
  if ( sBaseClassName ) {
    strncpy( m_sBaseClassName, sBaseClassName, sizeof(m_sBaseClassName)-1 );
  }
  m_pBaseClassId = ClassId( m_sBaseClassName );

  if ( !m_sClassName[0] ) {
    ON_ERROR("ON_ClassId::ON_ClassId() - missing class name");
    return;
  }

  const ON_ClassId* duplicate_class = ClassId( m_sClassName );
  // The m_mark0 > 2 test prevents opennurbs and Rhino from
  // having two ON_Object derived classes that have the same
  // name.  Plug-ins are free to use any name.
  if ( 0 != duplicate_class && m_mark0 > 2 )
  {
    char s[7];
    int ver;
    ON_WARNING("ON_ClassId::ON_ClassId() - class name already in use.  Will append number to make it unique.");
    for ( ver = 1; ver < 10000 && 0 != duplicate_class; ver++ )
    {
      IntToString(ver,s);
      s[6] = 0;
      strncpy( m_sClassName, sClassName, sizeof(m_sClassName)-1 );
      strncat( m_sClassName, s, sizeof(m_sClassName)-1 );
      duplicate_class = ClassId( m_sClassName );
    }
  }

  if ( 0 != duplicate_class )
  {
    // Do NOT permit core classes to have duplicate names.
    ON_ERROR("ON_ClassId::ON_ClassId() - class name already in use.");
    return;
  }

  if (    m_sClassName[0] != 'O'
       || m_sClassName[1] != 'N'
       || m_sClassName[2] != '_'
       || m_sClassName[3] != 'O'
       || m_sClassName[4] != 'b'
       || m_sClassName[5] != 'j'
       || m_sClassName[6] != 'e'
       || m_sClassName[7] != 'c'
       || m_sClassName[8] != 't'
       || m_sClassName[9] != 0 ) {
    if ( !m_sBaseClassName[0] ) 
    {
      ON_ERROR("ON_ClassId::ON_ClassId() - missing baseclass name.");
      return;
    }
  }

  g_bDisableDemotion = true;
  if ( ClassId( m_uuid ) ) 
  {
    g_bDisableDemotion = false;
    ON_ERROR("ON_ClassId::ON_ClassId() - class uuid already in use.");
    return;
  }
  g_bDisableDemotion = false;

  if ( ON_UuidIsNil( m_uuid ) ) {
    ON_ERROR("ON_ClassId::ON_ClassId() - class uuid is nill.");
    return;
  }

  // see if any derived classes need to be updated because their static
  // members got initialized first
  if ( m_sClassName[0] ) 
  {
    for ( ON_ClassId* p = m_p0; p; p = p->m_pNext )
    {
      if ( !p->m_pBaseClassId && p->m_sBaseClassName ) {
        if ( !strcmp( m_sClassName, p->m_sBaseClassName ) )
          p->m_pBaseClassId = this;
      }
    }
  }

  // Append to the list of class ids
  if ( m_p0 && m_p1 )
  {
    m_p1->m_pNext = this;
    m_p1 = this;
  }
  else
  {
    // first class id
    m_p0 = this;
  }
  m_p1 = this;
  m_p1->m_pNext = 0;
}
示例#15
0
 // CPropertyBase virtuals
 virtual LPCTSTR DefinedPropertyMapName()                              { return ClassId(); }
示例#16
0
bool CL_Integer::WriteTo (CL_Stream& s) const
{
    return s.Write (ClassId())  && s.Write (_value);
}
示例#17
0
void DwMessageComponent::_PrintDebugInfo(std::ostream& aStrm) const
{
    aStrm << "ObjectId:         " << ObjectId() << '\n';
    aStrm << "ClassId:          ";
	switch (ClassId()) {
	case kCidError:
		aStrm << "kCidError";
		break;
	case kCidUnknown:
        aStrm << "kCidUnknown";
		break;
	case kCidAddress:
        aStrm << "kCidAddress";
		break;
	case kCidAddressList:
        aStrm << "kCidAddressList";
		break;
	case kCidBody:
        aStrm << "kCidBody";
		break;
	case kCidBodyPart:
        aStrm << "kCidBodyPart";
		break;
	case kCidDispositionType:
        aStrm << "kCidDispositionType";
		break;
	case kCidMechanism:
        aStrm << "kCidMechanism";
		break;
	case kCidMediaType:
        aStrm << "kCidMediaType";
		break;
	case kCidParameter:
        aStrm << "kCidParameter";
		break;
	case kCidDateTime:
        aStrm << "kCidDateTime";
		break;
	case kCidEntity:
        aStrm << "kCidEntity";
		break;
	case kCidField:
        aStrm << "kCidField";
		break;
	case kCidFieldBody:
        aStrm << "kCidFieldBody";
		break;
	case kCidGroup:
        aStrm << "kCidGroup";
		break;
	case kCidHeaders:
        aStrm << "kCidHeaders";
		break;
	case kCidMailbox:
        aStrm << "kCidMailbox";
		break;
	case kCidMailboxList:
        aStrm << "kCidMailboxList";
		break;
	case kCidMessage:
        aStrm << "kCidMessage";
		break;
	case kCidMessageComponent:
        aStrm << "kCidMessageComponent";
		break;
	case kCidMsgId:
        aStrm << "kCidMsgId";
		break;
	case kCidText:
        aStrm << "kCidText";
		break;
	}
    aStrm << '\n';
    aStrm << "ClassName:        " << ClassName() << '\n';
    aStrm << "String:           " << mString << '\n';
    aStrm << "IsModified:       " << (IsModified() ? "True" : "False") << '\n';
    aStrm << "Parent ObjectId:  ";
    if (mParent) {
        aStrm << mParent->ObjectId() << '\n';
    }
    else {
        aStrm << "(none)\n";
    }
}
示例#18
0
void OOPDouble::Write(TPZStream & buf, int withclassid){
	TPZSaveable::Write(buf, withclassid);
	buf.Write(&fValue);
	int clsid = ClassId();
	buf.Write(&clsid);
}
示例#19
0
BOOL ON_UserData::IsUnknownUserData() const
{
  return (ClassId() == &ON_UnknownUserData::m_ON_UnknownUserData_class_id)?true:false;
}
示例#20
0
bool CL_TimeOfDay::WriteTo (CL_Stream& s) const
{
    return s.Write (ClassId())  && s.Write (_numSecs);
}