~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/temporal.h

doc modifications

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008-2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008-2009 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
43
43
#define DRIZZLED_TEMPORAL_H
44
44
 
45
45
#define DRIZZLE_MAX_SECONDS 59
46
 
#define DRIZZLE_MAX_SECONDS_WITH_LEAP 61
47
46
#define DRIZZLE_MAX_MINUTES 59
48
47
#define DRIZZLE_MAX_HOURS 23
49
48
#define DRIZZLE_MAX_DAYS 31
67
66
 
68
67
#define DRIZZLE_YY_PART_YEAR  70
69
68
 
70
 
#include <drizzled/calendar.h>
 
69
#include "drizzled/calendar.h"
71
70
 
72
71
#include <cassert>
73
72
#include <ostream>
74
73
 
75
74
/* Outside forward declarations */
76
 
namespace type {
77
 
class Decimal;
78
 
}
 
75
class my_decimal;
79
76
 
80
77
namespace drizzled
81
78
{
422
419
   *
423
420
   * @param Pointer to a time_t to convert to
424
421
   */
425
 
  virtual void to_time_t(time_t &to) const;
 
422
  virtual void to_time_t(time_t *to) const;
426
423
 
427
424
  /**
428
425
   * Attempts to populate the Date instance based
436
433
  virtual bool from_time_t(const time_t from);
437
434
 
438
435
  /**
439
 
   * Fills a supplied type::Decimal with a representation of
 
436
   * Fills a supplied my_decimal with a representation of
440
437
   * the Date value.
441
438
   *
442
 
   * @param Pointer to the type::Decimal to fill
 
439
   * @param Pointer to the my_decimal to fill
443
440
   */
444
 
  virtual void to_decimal(type::Decimal *to) const;
 
441
  virtual void to_decimal(my_decimal *to) const;
445
442
 
446
443
  friend class TemporalInterval;
447
444
  friend class Timestamp;
488
485
  bool is_valid_datetime() const {return false;}
489
486
  bool is_valid_time() const {return is_valid();}
490
487
  bool is_valid_timestamp() const {return false;}
491
 
 
492
488
  /** Returns whether the temporal value is valid date. */
493
489
  bool is_valid() const;
494
 
  bool is_fuzzy_valid() const;
495
490
 
496
491
  /**
497
492
   * Fills a supplied char string with a
535
530
  void to_int32_t(int32_t *to) const;
536
531
 
537
532
  /**
538
 
   * Fills a supplied 8-byte integer pointer with an
539
 
   * integer representation of the Time
540
 
   * value. It is assume seconds past unix epoch
541
 
   *
542
 
   * @param Integer to fill.
543
 
   */
544
 
  void to_uint64_t(uint64_t &to) const;
545
 
 
546
 
  /**
547
533
   * Attempts to populate the Time instance based
548
534
   * on the contents of a supplied 4-byte integer.
549
535
   *
571
557
  bool from_time_t(const time_t from);
572
558
 
573
559
  /**
574
 
   * Fills a supplied type::Decimal with a representation of
 
560
   * Fills a supplied my_decimal with a representation of
575
561
   * the Time value.
576
562
   *
577
 
   * @param Pointer to the type::Decimal to fill
 
563
   * @param Pointer to the my_decimal to fill
578
564
   */
579
 
  void to_decimal(type::Decimal *to) const;
 
565
  void to_decimal(my_decimal *to) const;
580
566
 
581
567
  friend class Date;
582
568
  friend class DateTime;
657
643
   * @param time_t to convert from
658
644
   */
659
645
  bool from_time_t(const time_t from);
660
 
  bool from_timeval(struct timeval &_timeval);
661
646
 
662
647
  /**
663
648
   * Attempts to populate the DateTime instance based
686
671
  void to_tm(struct tm *to) const;
687
672
 
688
673
  /**
689
 
   * Fills a supplied type::Decimal with a representation of
 
674
   * Fills a supplied my_decimal with a representation of
690
675
   * the DateTime value.
691
676
   *
692
 
   * @param Pointer to the type::Decimal to fill
 
677
   * @param Pointer to the my_decimal to fill
693
678
   */
694
 
  void to_decimal(type::Decimal *to) const;
 
679
  void to_decimal(my_decimal *to) const;
695
680
 
696
681
  friend class Timestamp;
697
682
};
753
738
   *
754
739
   * @param Pointer to a time_t to convert to
755
740
   */
756
 
  void to_time_t(time_t &to) const;
 
741
  void to_time_t(time_t *to) const;
757
742
};
758
743
 
759
744
/**
801
786
   *
802
787
   * @param timeval to fill.
803
788
   */
804
 
  void to_timeval(struct timeval &to) const;
 
789
  void to_timeval(struct timeval *to) const;
805
790
};
806
791
 
807
792
/**