Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Unified Diff: third_party/protobuf/php/src/Google/Protobuf/Internal/EnumBuilderContext.php

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
-}
+}

Powered by Google App Engine
This is Rietveld 408576698