当前位置: 首页>>代码示例>>C#>>正文


C# Parse类代码示例

本文整理汇总了C#中Parse的典型用法代码示例。如果您正苦于以下问题:C# Parse类的具体用法?C# Parse怎么用?C# Parse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Parse类属于命名空间,在下文中一共展示了Parse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PartsShouldReturnCellsWhenTheParseRepresentsARow

 public void PartsShouldReturnCellsWhenTheParseRepresentsARow()
 {
     Parse row = new Parse("<tr><td>one</td><td>two</td><td>three</td></tr>", new string[]{"tr", "td"});
     Assert.AreEqual("one", row.Parts.Body);
     Assert.AreEqual("two", row.Parts.More.Body);
     Assert.AreEqual("three", row.Parts.More.More.Body);
 }
开发者ID:vaibhavsapre,项目名称:fitsharp,代码行数:7,代码来源:ParseTest.cs

示例2: sqlite3IsReadOnly

    /*
    ** Check to make sure the given table is writable.  If it is not
    ** writable, generate an error message and return 1.  If it is
    ** writable return 0;
    */
    static bool sqlite3IsReadOnly( Parse pParse, Table pTab, int viewOk )
    {
      /* A table is not writable under the following circumstances:
      **
      **   1) It is a virtual table and no implementation of the xUpdate method
      **      has been provided, or
      **   2) It is a system table (i.e. sqlite_master), this call is not
      **      part of a nested parse and writable_schema pragma has not
      **      been specified.
      **
      ** In either case leave an error message in pParse and return non-zero.
      */
      if (
         ( IsVirtual( pTab )
          && sqlite3GetVTable( pParse.db, pTab ).pMod.pModule.xUpdate == null )
        || ( ( pTab.tabFlags & TF_Readonly ) != 0
      && ( pParse.db.flags & SQLITE_WriteSchema ) == 0
      && pParse.nested == 0 )
      )
      {
        sqlite3ErrorMsg( pParse, "table %s may not be modified", pTab.zName );
        return true;
      }

#if !SQLITE_OMIT_VIEW
      if ( viewOk == 0 && pTab.pSelect != null )
      {
        sqlite3ErrorMsg( pParse, "cannot modify %s because it is a view", pTab.zName );
        return true;
      }
#endif
      return false;
    }
开发者ID:pragmat1c,项目名称:coolstorage,代码行数:38,代码来源:delete_c.cs

示例3: DoTable

        public void DoTable(Fixture fixture, Parse tables, object[] businessObjects, int right, int wrong, int ignores, int exceptions)
        {
            BusinessObjectRowFixture.objects = businessObjects;
            RunTest(fixture, tables);

            TestUtils.CheckCounts(resultCounts, right, wrong, ignores, exceptions);
        }
开发者ID:GibSral,项目名称:fitsharp,代码行数:7,代码来源:RowFixtureTest.cs

示例4: MarksDifferentStringCellAsWrong

 public void MarksDifferentStringCellAsWrong()
 {
     var cell = new Parse("td", "something else", null, null);
     var fixture = new Fixture {Processor = new Service.Service()};
     fixture.CellOperation.Check(new TypedValue("something"), cell);
     Assert.AreEqual("\n<td class=\"fail\">something else <span class=\"fit_label\">expected</span><hr />something <span class=\"fit_label\">actual</span></td>", cell.ToString());
 }
开发者ID:blueroc2003,项目名称:fitsharp,代码行数:7,代码来源:CellMatching.cs

示例5: DoTable

        public override void DoTable(Parse theTable)
        {
            Parse embeddedTables = GetEmbeddedTables(theTable);
            Parse expectedCell = GetExpectedCell(theTable);

            var writer = new StoryTestCopyWriter();
            var storyTest = new StoryTest(Processor, writer)
                .WithParsedInput(new Parse("div", string.Empty, embeddedTables, null));
            storyTest.Execute(new Service.Service(Processor));

            SetEmbeddedTables(theTable, writer.ResultTables);

            if (expectedCell != null) {
                var actual = new FixtureTable(writer.ResultTables);
                var expected = new FixtureTable(expectedCell.Parts);
                string differences = actual.Differences(expected);
                if (differences.Length == 0) {
                    Right(expectedCell);
                }
                else {
                    Wrong(expectedCell);
                    expectedCell.More = ParseNode.MakeCells(Escape(differences));
                    expectedCell.More.SetAttribute(CellAttribute.Status, TestStatus.Wrong);
                }
            }
        }
开发者ID:DioF,项目名称:fitsharp,代码行数:26,代码来源:SpecifyFixture.cs

示例6: sqlite3BeginWriteOperation

 // Generate VDBE code that prepares for doing an operation that might change the database.
 //
 // This routine starts a new transaction if we are not already within a transaction.  If we are already within a transaction, then a checkpoint
 // is set if the setStatement parameter is true.  A checkpoint should be set for operations that might fail (due to a constraint) part of
 // the way through and which will need to undo some writes without having to rollback the whole transaction.  For operations where all constraints
 // can be checked before any changes are made to the database, it is never necessary to undo a write and the checkpoint should not be set.
 internal static void sqlite3BeginWriteOperation(Parse pParse, int setStatement, int iDb)
 {
     var pToplevel = sqlite3ParseToplevel(pParse);
     sqlite3CodeVerifySchema(pParse, iDb);
     pToplevel.writeMask |= ((yDbMask)1) << iDb;
     pToplevel.isMultiWrite |= (byte)setStatement;
 }
开发者ID:JiujiangZhu,项目名称:feaserver,代码行数:13,代码来源:Build+Write.cs

示例7: AssertValuesInBody

 public static void AssertValuesInBody(Parse cell, string[] values)
 {
     foreach (string value in values)
     {
         AssertValueInBody(cell, value);
     }
 }
开发者ID:blueroc2003,项目名称:fitsharp,代码行数:7,代码来源:CellOperatorTest.cs

示例8: Differences

        private static string Differences(Parse theActual, Parse theExpected)
        {
            if (theActual == null) {
                return (theExpected != null ? FormatNodeDifference(theActual, theExpected) : string.Empty);
            }
            if (theExpected == null) {
                return FormatNodeDifference(theActual, theExpected);
            }
            var actualString = theActual.ToString().Replace("\n", string.Empty).Replace("\r", string.Empty);
            var expectedString = theExpected.ToString().Replace("\n", string.Empty).Replace("\r", string.Empty);
            if (actualString == expectedString) return string.Empty;

            var expected = new Expected(theExpected);
            if (theActual.Tag != expected.Node.Tag) {
                return FormatNodeDifference(theActual, expected.Node);
            }
            string result = BodyDifferences(theActual.Body,  expected.Node.Body);
            if (result.Length > 0) {
                return string.Format("in {0} body, {1}", theActual.Tag, result);
            }
            result = Differences(theActual.Parts,  theExpected.Parts);
            if (result.Length > 0) {
                return string.Format("in {0}, {1}", theActual.Tag, result);
            }
            return Differences(theActual.More, theExpected.More);
        }
开发者ID:vaibhavsapre,项目名称:fitsharp,代码行数:26,代码来源:FixtureTable.cs

示例9: Main

        static void Main(string[] args)
        {
            var articles = GetArticles(@"./Articles");
            int index = 0;

            //Get overall most used character in all articles
            var parse = new Parse(articles);
            Console.WriteLine("Overall most used character in articles: " + parse.GetCharacter());
            Console.WriteLine("Character was used: " + parse.GetNumber());

            //Get overall most used character in each articles
            var text = GetNextArticle(articles);
            while (text != null)
            {
                index++;
                var mostUsed = new Parse(text);

                Console.WriteLine("The most used character in article " + index + " : " + mostUsed.GetCharacter() + " repeated " + mostUsed.GetNumber() + " times");

                text = GetNextArticle(articles);
            }

            Console.WriteLine("Press any key to quit");
            Console.ReadLine();
        }
开发者ID:samriddhi,项目名称:StringInspector,代码行数:25,代码来源:Program.cs

示例10: testText

    public void testText()
    {
        string[] tags ={"td"};
        Parse p = new Parse("<td>a&lt;b</td>", tags);
        Assert.AreEqual("a&lt;b", p.body);
        Assert.AreEqual("a<b", p.text());
        p = new Parse("<td>\ta&gt;b&nbsp;&amp;&nbsp;b>c &&&lt;</td>", tags);
        Assert.AreEqual("a>b & b>c &&<", p.text());
        p = new Parse("<td>\ta&gt;b&nbsp;&amp;&nbsp;b>c &&lt;</td>", tags);
        Assert.AreEqual("a>b & b>c &<", p.text());
        p = new Parse("<TD><P><FONT FACE=\"Arial\" SIZE=2>GroupTestFixture</FONT></TD>", tags);
        Assert.AreEqual("GroupTestFixture",p.text());

        Assert.AreEqual("", Parse.htmlToText("&nbsp;"));
        Assert.AreEqual("a b", Parse.htmlToText("a <tag /> b"));
        Assert.AreEqual("a", Parse.htmlToText("a &nbsp;"));
        Assert.AreEqual("a", Parse.htmlToText("\u00a0 a \u00a0"));
        Assert.AreEqual("&nbsp;", Parse.htmlToText("&amp;nbsp;"));
        Assert.AreEqual("1     2", Parse.htmlToText("1 &nbsp; &nbsp; 2"));
        Assert.AreEqual("1     2", Parse.htmlToText("1 \u00a0\u00a0\u00a0\u00a02"));
        Assert.AreEqual("a", Parse.htmlToText("  <tag />a"));
        Assert.AreEqual("a\nb", Parse.htmlToText("a<br />b"));

        Assert.AreEqual("ab", Parse.htmlToText("<font size=+1>a</font>b"));
        Assert.AreEqual("ab", Parse.htmlToText("a<font size=+1>b</font>"));
        Assert.AreEqual("a<b", Parse.htmlToText("a<b"));

        Assert.AreEqual("a\nb\nc\nd", Parse.htmlToText("a<br>b<br/>c<  br   /   >d"));
        Assert.AreEqual("a\nb", Parse.htmlToText("a</p><p>b"));
        Assert.AreEqual("a\nb", Parse.htmlToText("a< / p >   <   p  >b"));
    }
开发者ID:juherr,项目名称:fit,代码行数:31,代码来源:ParseTest.cs

示例11: sqlite3AuthCheck

        /*
        ** Do an authorization check using the code and arguments given.  Return
        ** either SQLITE_OK (zero) or SQLITE_IGNORE or SQLITE_DENY.  If SQLITE_DENY
        ** is returned, then the error count and error message in pParse are
        ** modified appropriately.
        */
        int sqlite3AuthCheck(
Parse *pParse,
int code,
string zArg1,
string zArg2,
string zArg3
)
        {
            sqlite3 db = pParse->db;
            int rc;

            /* Don't do any authorization checks if the database is initialising
            ** or if the parser is being invoked from within sqlite3_declare_vtab.
            */
            if( db->init.busy || IN_DECLARE_VTAB ){
            return SQLITE_OK;
            }

            if( db->xAuth==0 ){
            return SQLITE_OK;
            }
            rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext);
            if( rc==SQLITE_DENY ){
            sqlite3ErrorMsg(pParse, "not authorized");
            pParse->rc = SQLITE_AUTH;
            }else if( rc!=SQLITE_OK && rc!=SQLITE_IGNORE ){
            rc = SQLITE_DENY;
            sqliteAuthBadReturnCode(pParse);
            }
            return rc;
        }
开发者ID:RainsSoft,项目名称:CsharpSQLite,代码行数:37,代码来源:auth_c.cs

示例12: testRecursing

 public void testRecursing()
 {
     Parse p = new Parse("leader<table><TR><Td>body</tD></TR></table>trailer");
     Assert.AreEqual(null, p.body);
     Assert.AreEqual(null, p.parts.body);
     Assert.AreEqual("body", p.parts.parts.body);
 }
开发者ID:juherr,项目名称:fit,代码行数:7,代码来源:ParseTest.cs

示例13: testIterating

 public void testIterating()
 {
     Parse p = new Parse("leader<table><tr><td>one</td><td>two</td><td>three</td></tr></table>trailer");
     Assert.AreEqual("one", p.parts.parts.body);
     Assert.AreEqual("two", p.parts.parts.more.body);
     Assert.AreEqual("three", p.parts.parts.more.more.body);
 }
开发者ID:juherr,项目名称:fit,代码行数:7,代码来源:ParseTest.cs

示例14: MakeCell

 public override Tree<Cell> MakeCell(string text, string tag, IEnumerable<Tree<Cell>> branches) {
     var result = new Parse(tag, text, null, null);
     foreach (var branch in branches) {
         result.Add(branch);
     }
     return result;
 }
开发者ID:GibSral,项目名称:fitsharp,代码行数:7,代码来源:Service.cs

示例15: Main

        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Parse myParser = new Parse();
            string[] filenames = { "test1.cir", "multiparams.cir", "test2.cir", "test3.cir", "q2n222a.cir", "missing.cir", "nocircuit.cir",
                                 "shortSubcircuit.cir", "bogusName.cir", "bogusparams1.cir", "firstLineCommentTest.cir", 
                                 "nameCharsTestFail.cir", "nameCharsTestPass.cir", "braceTest.cir" };
            foreach( string filename in filenames )
            {
                try
                {
                    ComponentInfo result = myParser.ParseFile(filename );
                    Console.WriteLine("Parsing file '{0}' found {1}",
                        filename, result.ToString() );
                }
                catch (Exception e)
                {
                    // Let the user know what went wrong.
                    Console.WriteLine("ParseFile( {0} ) error:", filename);
                    Console.WriteLine(e.Message);
                }
            }
            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();

        }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:27,代码来源:Program.cs


注:本文中的Parse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。