Exemple #1
0
SEXP
SmokeObject::sexpFromPtr(void *ptr, const Class *klass,
                         bool allocated, bool copy)
{
  SmokeObject *so = fromPtr(ptr, klass, allocated, copy);
  if (!so)
    return R_NilValue;
  else return so->sexp();
}
Exemple #2
0
SmokeObject *SmokeObject::fromPtr(void *ptr, const SmokeType &type,
                                  bool allocated, bool copy)
{
  return fromPtr(ptr, type.smoke(), type.classId(), allocated, copy);
}
Exemple #3
0
SmokeObject *SmokeObject::fromPtr(void *ptr, Smoke *smoke, const char *name,
                                  bool allocated, bool copy)
{
  return fromPtr(ptr, Class::fromSmokeName(smoke, name), allocated, copy);
}
Exemple #4
0
SmokeObject *SmokeObject::fromPtr(void *ptr, Smoke *smoke, int classId,
                                  bool allocated, bool copy)
{
  return fromPtr(ptr, Class::fromSmokeId(smoke, classId), allocated, copy);
}
// ---------------------------------------------------------------------------
// TPresCondValidity::GetValidity()
// ---------------------------------------------------------------------------
//	
EXPORT_C TInt TPresCondValidity::GetValidityL(const TDesC& aRuleID, 
                                        RArray<TTimePeriod>& aValidTimes)
	{
    OPENG_DP(D_OPENG_LIT( "TPresCondValidity::GetValidity()" ) );
    OPENG_DP(D_OPENG_LIT( "     aRuleID = %S"),&aRuleID);

	CXdmDocumentNode* validityNode = GetValidityNodeL(aRuleID, EFalse);
	if(validityNode==NULL)
	    return KErrNotFound;
	
	TInt nodeCount = validityNode->NodeCount();
    OPENG_DP(D_OPENG_LIT( "     validityNode->NodeCount() = %d"),nodeCount);
	if(!nodeCount)
	    return KErrNotFound;
	
	RPointerArray<CXdmDocumentNode> fromNodes;
	RPointerArray<CXdmDocumentNode> untilNodes;
	
	HBufC* fromPtr(NULL);
	HBufC* untilPtr(NULL); 
	
	TTime fromTime(0);
	TTime untilTime(0);
	
	
	TTimePeriod myTimePeriod;
	
    // Get all the <from> nodes
  	validityNode->Find(KXdmFrom, fromNodes);
    validityNode->Find(KXdmUntil, untilNodes);
    
    if((fromNodes.Count()) != (untilNodes.Count()))
        {
        fromNodes.Close();
        untilNodes.Close();
        return KErrGeneral;
        }
        
    
    nodeCount = fromNodes.Count();
    OPENG_DP(D_OPENG_LIT( "     nodesCount = %d" ),nodeCount);

	for(TInt i=0; i<nodeCount; i++)
	    {
        aValidTimes.Append(myTimePeriod);

	    // processing from
	    (fromNodes[i])->SetLeafNode(ETrue);
	    fromPtr = CnvUtfConverter::ConvertToUnicodeFromUtf8L((fromNodes[i])->LeafNodeContent());
	    CleanupStack::PushL(fromPtr);
	    OPENG_DP(D_OPENG_LIT( "     from string at i(%d): %S" ),i,&(*fromPtr));
	    ParseFromXMLTimeString(fromPtr->Des(), fromTime);
	    CleanupStack::PopAndDestroy(fromPtr);
	    ConvertToLocal(fromTime);
	    ((aValidTimes[i]).from).Set(fromTime.DateTime().Year(),fromTime.DateTime().Month(),
	        fromTime.DateTime().Day(),fromTime.DateTime().Hour(),fromTime.DateTime().Minute(),
	        fromTime.DateTime().Second(), fromTime.DateTime().MicroSecond());
	    OPENG_DP(D_OPENG_LIT( "     from at i = %d" ),i);
	    LogDateTime((aValidTimes[i]).from);
	    
	    
	    // processing until
	    (untilNodes[i])->SetLeafNode(ETrue);
	    untilPtr = CnvUtfConverter::ConvertToUnicodeFromUtf8L((untilNodes[i])->LeafNodeContent());
	    CleanupStack::PushL(untilPtr);
	    OPENG_DP(D_OPENG_LIT( "     until string at i(%d): %S" ),i,&(*untilPtr));
	    ParseFromXMLTimeString(untilPtr->Des(), untilTime);
	    CleanupStack::PopAndDestroy(untilPtr);
	    ConvertToLocal(untilTime);
	    (aValidTimes[i]).until.Set(untilTime.DateTime().Year(),untilTime.DateTime().Month(),
	        untilTime.DateTime().Day(),untilTime.DateTime().Hour(),untilTime.DateTime().Minute(),
	        untilTime.DateTime().Second(),untilTime.DateTime().MicroSecond());
	    OPENG_DP(D_OPENG_LIT( "     until at i = %d" ),i);
	    LogDateTime((aValidTimes[i]).until);

	    }
	    
    fromNodes.Close();
    untilNodes.Close();
	return KErrNone;
	}