upnpmediaserver/contentdirectoryservice/src/upnpcdutils.cpp
branchnew development branch with rendering state machine and other goodies
changeset 38 5360b7ddc251
parent 32 3785f754ee62
equal deleted inserted replaced
32:3785f754ee62 38:5360b7ddc251
    25 #include "upnperror.h"
    25 #include "upnperror.h"
    26 #include "upnpcommonupnplits.h"
    26 #include "upnpcommonupnplits.h"
    27 #include "upnpstring.h"
    27 #include "upnpstring.h"
    28 #include "upnpcons.h"
    28 #include "upnpcons.h"
    29 #include <utf.h>
    29 #include <utf.h>
    30 #include <xml/dom/xmlengdocument.h>
    30 #include <xmlengdocument.h>
    31 #include <e32math.h>
    31 #include <e32math.h>
    32 
    32 
    33 // ============================ MEMBER FUNCTIONS ===============================
    33 // ============================ MEMBER FUNCTIONS ===============================
    34 
    34 
    35 // -----------------------------------------------------------------------------
    35 // -----------------------------------------------------------------------------
   608         HBufC* valueReplaced16 = aValue.AllocL();
   608         HBufC* valueReplaced16 = aValue.AllocL();
   609         return valueReplaced16;
   609         return valueReplaced16;
   610     }   
   610     }   
   611 }
   611 }
   612 
   612 
       
   613 TBool UpnpCdUtils::ValidateDateLength(TInt aDateLength)
       
   614     {
       
   615     TBool retVal = ETrue;
       
   616     
       
   617     if ((aDateLength!=EDay)&&(aDateLength!=ESecond)&&
       
   618             (aDateLength!=ETimeOffset1)&&(aDateLength!=EMiliSecond)&&
       
   619             (aDateLength!=ETimeOffset2)&&(aDateLength!=EZone1)&&
       
   620             (aDateLength!=EZone2))                                     
       
   621         {
       
   622         retVal = EFalse;
       
   623         }
       
   624     
       
   625     return retVal;
       
   626     }
       
   627 
   613 // -----------------------------------------------------------------------------
   628 // -----------------------------------------------------------------------------
   614 // CUpnpElementFactory::ValidateDateL()
   629 // CUpnpElementFactory::ValidateDateL()
   615 // Only Those date string is validate
   630 // Only Those date string is validate
   616 // YYYY-MM-DD
   631 // YYYY-MM-DD
   617 // YYYY-MM-DDTHH:MM:SS
   632 // YYYY-MM-DDTHH:MM:SS
   622 // YYYY-MM-DDTHH:MM:SS.xxx+HH:MM
   637 // YYYY-MM-DDTHH:MM:SS.xxx+HH:MM
   623 // -----------------------------------------------------------------------------
   638 // -----------------------------------------------------------------------------
   624 //
   639 //
   625 TBool UpnpCdUtils::ValidateDateL( TPtrC8 aValue )
   640 TBool UpnpCdUtils::ValidateDateL( TPtrC8 aValue )
   626     {         
   641     {         
   627  /*   TBool wrong = 0;
   642     TBool wrong = 0;
   628 
   643 
   629     TInt dateLength = aValue.Length();                                         
   644     TInt dateLength = aValue.Length();                                         
   630 
   645 
   631     if ((dateLength!=EDay)&&(dateLength!=ESecond)&&
   646     if (!(ValidateDateLength(dateLength)))
   632         (dateLength!=ETimeOffset1)&&(dateLength!=EMiliSecond)&&
   647         {
   633         (dateLength!=ETimeOffset2)&&(dateLength!=EZone1)&&
   648         return EFalse;
   634         (dateLength!=EZone2))                                     
       
   635         {
       
   636         return EFalse;                
       
   637         }
   649         }
   638     else
   650     else
   639         {
   651         {
   640         const TChar KColo = ':';
   652         const TChar KColo = ':';
   641         const TChar KMinus = '-';
   653         const TChar KMinus = '-';
   822 
   834 
   823     if (wrong)
   835     if (wrong)
   824         {                        
   836         {                        
   825         return EFalse;      
   837         return EFalse;      
   826         }
   838         }
   827 */
   839 
   828     return ETrue;
   840     return ETrue;
   829     }
   841     }
   830     
   842     
   831 // -----------------------------------------------------------------------------
   843 // -----------------------------------------------------------------------------
   832 // UpnpCdUtils::StringToUint
   844 // UpnpCdUtils::StringToUint