~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/temporal.h

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

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
 
4
 *  Copyright (C) 2008-2009 Sun Microsystems, Inc.
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
46
47
#define DRIZZLE_MAX_MINUTES 59
47
48
#define DRIZZLE_MAX_HOURS 23
48
49
#define DRIZZLE_MAX_DAYS 31
66
67
 
67
68
#define DRIZZLE_YY_PART_YEAR  70
68
69
 
69
 
#include "drizzled/calendar.h"
 
70
#include <drizzled/calendar.h>
70
71
 
71
72
#include <cassert>
72
73
#include <ostream>
73
74
 
74
75
/* Outside forward declarations */
75
 
class my_decimal;
 
76
namespace type {
 
77
class Decimal;
 
78
}
76
79
 
77
80
namespace drizzled
78
81
{
419
422
   *
420
423
   * @param Pointer to a time_t to convert to
421
424
   */
422
 
  virtual void to_time_t(time_t *to) const;
 
425
  virtual void to_time_t(time_t &to) const;
423
426
 
424
427
  /**
425
428
   * Attempts to populate the Date instance based
433
436
  virtual bool from_time_t(const time_t from);
434
437
 
435
438
  /**
436
 
   * Fills a supplied my_decimal with a representation of
 
439
   * Fills a supplied type::Decimal with a representation of
437
440
   * the Date value.
438
441
   *
439
 
   * @param Pointer to the my_decimal to fill
 
442
   * @param Pointer to the type::Decimal to fill
440
443
   */
441
 
  virtual void to_decimal(my_decimal *to) const;
 
444
  virtual void to_decimal(type::Decimal *to) const;
442
445
 
443
446
  friend class TemporalInterval;
444
447
  friend class Timestamp;
485
488
  bool is_valid_datetime() const {return false;}
486
489
  bool is_valid_time() const {return is_valid();}
487
490
  bool is_valid_timestamp() const {return false;}
 
491
 
488
492
  /** Returns whether the temporal value is valid date. */
489
493
  bool is_valid() const;
 
494
  bool is_fuzzy_valid() const;
490
495
 
491
496
  /**
492
497
   * Fills a supplied char string with a
530
535
  void to_int32_t(int32_t *to) const;
531
536
 
532
537
  /**
 
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
  /**
533
547
   * Attempts to populate the Time instance based
534
548
   * on the contents of a supplied 4-byte integer.
535
549
   *
557
571
  bool from_time_t(const time_t from);
558
572
 
559
573
  /**
560
 
   * Fills a supplied my_decimal with a representation of
 
574
   * Fills a supplied type::Decimal with a representation of
561
575
   * the Time value.
562
576
   *
563
 
   * @param Pointer to the my_decimal to fill
 
577
   * @param Pointer to the type::Decimal to fill
564
578
   */
565
 
  void to_decimal(my_decimal *to) const;
 
579
  void to_decimal(type::Decimal *to) const;
566
580
 
567
581
  friend class Date;
568
582
  friend class DateTime;
643
657
   * @param time_t to convert from
644
658
   */
645
659
  bool from_time_t(const time_t from);
 
660
  bool from_timeval(struct timeval &_timeval);
646
661
 
647
662
  /**
648
663
   * Attempts to populate the DateTime instance based
671
686
  void to_tm(struct tm *to) const;
672
687
 
673
688
  /**
674
 
   * Fills a supplied my_decimal with a representation of
 
689
   * Fills a supplied type::Decimal with a representation of
675
690
   * the DateTime value.
676
691
   *
677
 
   * @param Pointer to the my_decimal to fill
 
692
   * @param Pointer to the type::Decimal to fill
678
693
   */
679
 
  void to_decimal(my_decimal *to) const;
 
694
  void to_decimal(type::Decimal *to) const;
680
695
 
681
696
  friend class Timestamp;
682
697
};
738
753
   *
739
754
   * @param Pointer to a time_t to convert to
740
755
   */
741
 
  void to_time_t(time_t *to) const;
 
756
  void to_time_t(time_t &to) const;
742
757
};
743
758
 
744
759
/**
786
801
   *
787
802
   * @param timeval to fill.
788
803
   */
789
 
  void to_timeval(struct timeval *to) const;
 
804
  void to_timeval(struct timeval &to) const;
790
805
};
791
806
 
792
807
/**