Index: third_party/protobuf/php/src/Google/Protobuf/Internal/EnumBuilderContext.php |
diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/FrameworkPortability.cs b/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumBuilderContext.php |
similarity index 69% |
copy from third_party/protobuf/csharp/src/Google.Protobuf/FrameworkPortability.cs |
copy to third_party/protobuf/php/src/Google/Protobuf/Internal/EnumBuilderContext.php |
index c8060f6ca8ee3db3f0565a6fe9fbe8cfc928c9b1..c1dac24dd8dd22356b7a962e7c64cdd575fa59ab 100644 |
--- a/third_party/protobuf/csharp/src/Google.Protobuf/FrameworkPortability.cs |
+++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumBuilderContext.php |
@@ -1,4 +1,5 @@ |
-#region Copyright notice and license |
+<?php |
+ |
// Protocol Buffers - Google's data interchange format |
// Copyright 2008 Google Inc. All rights reserved. |
// https://developers.google.com/protocol-buffers/ |
@@ -28,22 +29,35 @@ |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-#endregion |
-using System; |
-using System.Text.RegularExpressions; |
+namespace Google\Protobuf\Internal; |
+ |
+use Google\Protobuf\Internal\EnumDescriptor; |
+use Google\Protobuf\Internal\EnumValueDescriptor; |
-namespace Google.Protobuf |
+class EnumBuilderContext |
{ |
- /// <summary> |
- /// Class containing helpful workarounds for various platform compatibility |
- /// </summary> |
- internal static class FrameworkPortability |
+ |
+ private $descriptor; |
+ private $pool; |
+ |
+ public function __construct($full_name, $klass, $pool) |
+ { |
+ $this->descriptor = new EnumDescriptor(); |
+ $this->descriptor->setFullName($full_name); |
+ $this->descriptor->setClass($klass); |
+ $this->pool = $pool; |
+ } |
+ |
+ public function value($name, $number) |
+ { |
+ $value = new EnumValueDescriptor(); |
+ $this->descriptor->addValue($number, $value); |
+ return $this; |
+ } |
+ |
+ public function finalizeToPool() |
{ |
- // The value of RegexOptions.Compiled is 8. We can test for the presence at |
- // execution time using Enum.IsDefined, so a single build will do the right thing |
- // on each platform. (RegexOptions.Compiled isn't supported by PCLs.) |
- internal static readonly RegexOptions CompiledRegexWhereAvailable = |
- Enum.IsDefined(typeof(RegexOptions), 8) ? (RegexOptions)8 : RegexOptions.None; |
+ $this->pool->addEnumDescriptor($this->descriptor); |
} |
-} |
+} |