1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/bindings/Date.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +/* Representation for dates. */ 1.11 + 1.12 +#ifndef mozilla_dom_Date_h 1.13 +#define mozilla_dom_Date_h 1.14 + 1.15 +#include "js/TypeDecls.h" 1.16 + 1.17 +namespace mozilla { 1.18 +namespace dom { 1.19 + 1.20 +class Date 1.21 +{ 1.22 +public: 1.23 + // Not inlining much here to avoid the includes we'd need. 1.24 + Date(); 1.25 + Date(double aMilliseconds) 1.26 + : mMsecSinceEpoch(aMilliseconds) 1.27 + {} 1.28 + 1.29 + bool IsUndefined() const; 1.30 + double TimeStamp() const 1.31 + { 1.32 + return mMsecSinceEpoch; 1.33 + } 1.34 + void SetTimeStamp(double aMilliseconds) 1.35 + { 1.36 + mMsecSinceEpoch = aMilliseconds; 1.37 + } 1.38 + // Can return false if CheckedUnwrap fails. This will NOT throw; 1.39 + // callers should do it as needed. 1.40 + bool SetTimeStamp(JSContext* aCx, JSObject* aObject); 1.41 + 1.42 + bool ToDateObject(JSContext* aCx, JS::MutableHandle<JS::Value> aRval) const; 1.43 + 1.44 +private: 1.45 + double mMsecSinceEpoch; 1.46 +}; 1.47 + 1.48 +} // namespace dom 1.49 +} // namespace mozilla 1.50 + 1.51 +#endif // mozilla_dom_Date_h