altova::Duration
This class enables you to process XML attributes or elements of type xs:duration.
Mit Hilfe dieser Klasse können XML-Attribute oder -Elemente vom Typ xs:duration verarbeitet werden.
Konstruktoren
| Name | Beschreibung | 
|---|---|
| Duration() | Initialisiert eine neue Instanz der Duration-Klasse auf einen leeren Wert. | 
| Duration(const DayTimeDuration& dt) | Initialisiert eine neue Instanz der Duration-Klasse auf eine durch das Argument dt definierte Zeitdauer (siehe altova::DayTimeDuration). | 
| Duration(const YearMonthDuration& ym) | Initialisiert eine neue Instanz der Duration-Klasse auf eine durch das Argument ym definierte Zeitdauer (siehe altova::YearMonthDuration). | 
| Duration(const YearMonthDuration& ym, const DayTimeDuration& dt) | Initialisiert eine neue Instanz der Duration-Klasse auf eine durch die Argumente dt und ym definierte Zeitdauer (siehe altova::YearMonthDuration und altova::DayTimeDuration ). | 
Methoden
| Name | Beschreibung | 
|---|---|
| int Days() const | Gibt die Anzahl der Tage in der aktuellen Duration-Instanz zurück. | 
| DayTimeDuration DayTime() const | Gibt die als DayTimeDuration Objekt ausgedrückte Zeitdauer in Tagen und Uhrzeitwerten zurück (siehe altova::DayTimeDuration). | 
| int Hours() const | Gibt die Anzahl der Stunden in der aktuellen Duration-Instanz zurück. | 
| bool IsNegative() const | Gibt den Booleschen Wert true zurück, wenn die aktuelle Duration-Instanz negativ ist. | 
| bool IsPositive() const | Gibt den Booleschen Wert true zurück, wenn die aktuelle Duration-Instanz positiv ist. | 
| int Minutes() const | Gibt die Anzahl der Minuten in der aktuellen Duration-Instanz zurück. | 
| int Months() const | Gibt die Anzahl der Monate in der aktuellen Duration-Instanz zurück. | 
| double Seconds() const | Gibt die Anzahl der Sekunden in der aktuellen Duration-Instanz zurück. | 
| YearMonthDuration YearMonth() const | Gibt die als YearMonthDuration-Objekt ausgedrückte Zeitdauer in Jahren und Monaten zurück (siehe altova::YearMonthDuration). | 
| int Years() const | Gibt die Anzahl der Jahre in der aktuellen Duration-Instanz zurück. | 
Beispiel
Im den folgenden Codefragment wird gezeigt, wie ein neues Duration-Objekten erstellt und Werte daraus ausgelesen werden.
| void ExampleDuration() { // Create an empty Duration object altova::Duration empty_duration = altova::Duration(); 
 // Create a Duration object using an existing duration value altova::Duration duration1 = altova::Duration(empty_duration); 
 // Create a YearMonth duration of six years and five months altova::YearMonthDuration yrduration = altova::YearMonthDuration(6, 5); 
 // Create a DayTime duration of four days, three hours, two minutes, and one second altova::DayTimeDuration dtduration = altova::DayTimeDuration(4, 3, 2, 1); 
 // Create a Duration object by combining the two previously created durations altova::Duration duration = altova::Duration(yrduration, dtduration); 
 // Get the number of years in this Duration instance cout << "Years: " << duration.Years() << endl; 
 // Get the number of months in this Duration instance cout << "Months: " << duration.Months() << endl; 
 // Get the number of days in this Duration instance cout << "Days: " << duration.Days() << endl; 
 // Get the number of hours in this Duration instance cout << "Hours: " << duration.Hours() << endl; 
 // Get the number of hours in this Duration instance cout << "Minutes: " << duration.Minutes() << endl; 
 // Get the number of seconds in this Duration instance cout << "Seconds: " << duration.Seconds() << endl; } |