Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(436)

Unified Diff: Tools/Google.Build.Utils/Text/Template.cs

Issue 12767046: Issue 377: New build for releasing a new version (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Patch Set: david comments Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Tools/Google.Build.Utils/Runner.cs ('k') | Tools/Google.Build.Utils/Text/TextUtils.cs » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Tools/Google.Build.Utils/Text/Template.cs
===================================================================
deleted file mode 100644
--- a/Tools/Google.Build.Utils/Text/Template.cs
/dev/null
@@ -1,72 0,0 @@
-/*
-Copyright 2011 Google Inc
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Google.Build.Utils.Text
-{
- /// <summary>
- /// Template helper class
- /// </summary>
- public class Template : List<string>
- {
- public Template(string data)
- {
- AddRange(data.Split(new[] { Environment.NewLine }, StringSplitOptions.None));
- }
- public Template() {}
-
- protected virtual string NewLine { get { return Environment.NewLine; } }
-
- /// <summary>
- /// Returns the formatted result of this template/
- /// </summary>
- public string ToString(Entries values)
- {
- string result = ToString();
- foreach (KeyValuePair<string, object> value in values)
- {
- result = result.Replace("{" value.Key "}", value.Value == null ? "" : value.Value.ToString());
- }
- return result;
- }
- public override string ToString()
- {
- return this.Aggregate((a, b) => a NewLine b);
- }
- }
-
- /// <summary>
- /// Class containing the key-value entries of a template.
- /// </summary>
- public class Entries : Dictionary<string, object>
- {
- /// <summary>
- /// Adds the formatted string to this template.
- /// </summary>
- public void Add(string key, string format, params object[] values)
- {
- if (values.Length == 0 || string.IsNullOrEmpty(format))
- {
- Add(key, (object) format);
- return;
- }
- Add(key, (object)string.Format(format, values));
- }
- }
-}
« no previous file with comments | « Tools/Google.Build.Utils/Runner.cs ('k') | Tools/Google.Build.Utils/Text/TextUtils.cs » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b