From 73e25a7628771f79c450adf0b0e806b093fb3c85 Mon Sep 17 00:00:00 2001
From: oden
Date: Thu, 14 Mar 2013 00:09:29 +0900
Subject: [PATCH] =?UTF-8?q?operator+(NSNumber*)=E6=9B=B8=E3=81=84=E3=81=9F?=
=?UTF-8?q?=E3=82=88=20refs=20#6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Docs/ID_h/Classes/ID/index.html | 95 ++++++++++++++++---
Docs/ID_h/Classes/ID/toc.html | 6 +-
Docs/ID_h/index.html | 2 +-
.../Classes/NSObject_OCppOperator_/index.html | 2 +-
Docs/NSObject+OCppOperator_h/index.html | 2 +-
Docs/OCppOperator_h/index.html | 2 +-
Docs/index.html | 10 +-
OCppOperator/ID.h | 8 ++
OCppOperator/ID.mm | 12 +++
9 files changed, 115 insertions(+), 24 deletions(-)
diff --git a/Docs/ID_h/Classes/ID/index.html b/Docs/ID_h/Classes/ID/index.html
index e725d62..cf7029d 100644
--- a/Docs/ID_h/Classes/ID/index.html
+++ b/Docs/ID_h/Classes/ID/index.html
@@ -228,13 +228,19 @@
コンストラクタ。デフォルトコンストラクタ兼コピーコンストラクタ
public
-
ID(
+
ID(
const id = nil);
Parameters
@@ -272,15 +278,42 @@ Discussion
@@ -364,7 +429,7 @@
~ID
Discussion
objectフィールドはreleaseされる。
@@ -396,7 +461,7 @@
Discussion
-
Last Updated: Wednesday, March 13, 2013
+
Last Updated: Thursday, March 14, 2013
diff --git a/Docs/ID_h/Classes/ID/toc.html b/Docs/ID_h/Classes/ID/toc.html
index 11cd491..cbce073 100644
--- a/Docs/ID_h/Classes/ID/toc.html
+++ b/Docs/ID_h/Classes/ID/toc.html
@@ -46,13 +46,15 @@
diff --git a/Docs/ID_h/index.html b/Docs/ID_h/index.html
index c2dda4f..7ac9a5b 100644
--- a/Docs/ID_h/index.html
+++ b/Docs/ID_h/index.html
@@ -230,7 +230,7 @@
Classes
-
Last Updated: Monday, March 11, 2013
+
Last Updated: Thursday, March 14, 2013
diff --git a/Docs/NSObject+OCppOperator_h/Classes/NSObject_OCppOperator_/index.html b/Docs/NSObject+OCppOperator_h/Classes/NSObject_OCppOperator_/index.html
index 6a6fa6d..2ba818d 100644
--- a/Docs/NSObject+OCppOperator_h/Classes/NSObject_OCppOperator_/index.html
+++ b/Docs/NSObject+OCppOperator_h/Classes/NSObject_OCppOperator_/index.html
@@ -252,7 +252,7 @@
Return Value
-
Last Updated: Monday, March 11, 2013
+
Last Updated: Thursday, March 14, 2013
diff --git a/Docs/NSObject+OCppOperator_h/index.html b/Docs/NSObject+OCppOperator_h/index.html
index 334c56a..10d9e47 100644
--- a/Docs/NSObject+OCppOperator_h/index.html
+++ b/Docs/NSObject+OCppOperator_h/index.html
@@ -230,7 +230,7 @@
Classes
-
Last Updated: Monday, March 11, 2013
+
Last Updated: Thursday, March 14, 2013
diff --git a/Docs/OCppOperator_h/index.html b/Docs/OCppOperator_h/index.html
index 678d192..94030b9 100644
--- a/Docs/OCppOperator_h/index.html
+++ b/Docs/OCppOperator_h/index.html
@@ -222,7 +222,7 @@
Introduction
-
Last Updated: Monday, March 11, 2013
+
Last Updated: Thursday, March 14, 2013
diff --git a/Docs/index.html b/Docs/index.html
index ee90064..cd82526 100644
--- a/Docs/index.html
+++ b/Docs/index.html
@@ -67,18 +67,22 @@
Functions
ID::ID
+ID::operator id
+ |
+
ID::operator+
|
-
|
-ID::operator id
+ID::ID
+ |
+
+ID::operator+
|
ID::operator+=
|
- |
diff --git a/OCppOperator/ID.h b/OCppOperator/ID.h
index 8d56b63..b6c9103 100644
--- a/OCppOperator/ID.h
+++ b/OCppOperator/ID.h
@@ -66,6 +66,14 @@ class ID
@return ID
*/
ID operator+(const id) const;
+ /*!
+ @method operator+
+ @abstract 加算演算子オーバーロード。
+ @discussion objectフィールドのdescription文字列と引数のdescription文字列を結合する。
+ @param number
+ @return ID
+ */
+ ID operator+(const NSNumber* const number) const;
/*!
@method operator+=
@abstract 加算後代入演算子オーバーロード。
diff --git a/OCppOperator/ID.mm b/OCppOperator/ID.mm
index 3c44bfb..68e63d4 100644
--- a/OCppOperator/ID.mm
+++ b/OCppOperator/ID.mm
@@ -35,6 +35,18 @@
return [[this->object description] stringByAppendingFormat:@"%@", source];
}
+ID ID::operator+(const NSNumber* const number) const
+{
+ if (![*this isKindOfClass:[NSNumber class]])
+ {
+ return *this + (id)number;
+ }
+
+ id left = [NSDecimalNumber decimalNumberWithString:[*this description]];
+ id right = [NSDecimalNumber decimalNumberWithString:[number description]];
+ return [left decimalNumberByAdding:right];
+}
+
ID& ID::operator+=(const id source)
{
[*this autorelease];