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


C++ TTAddress::getName方法代码示例

本文整理汇总了C++中TTAddress::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ TTAddress::getName方法的具体用法?C++ TTAddress::getName怎么用?C++ TTAddress::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TTAddress的用法示例。


在下文中一共展示了TTAddress::getName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TTNodeLibTestMiscellaneous

void TTNodeLibTestMiscellaneous(int& errorCount, int& testAssertionCount)
{
	TTTestLog("\n");
	TTTestLog("Miscellaneous Tests");
	
	// test convertUpperCasedName global method
	TTSymbol testSymbolA = "TestSymbolName";
	TTSymbol testSymbolB = "testSymbolName";
	TTSymbol testSymbolC = "testsymbolname";
	TTAddress result;
   

	convertUpperCasedNameInAddress(testSymbolA, result);
	TTTestAssertion("convertUpperCasedName: Test passes if \"TestSymbolName\" is converted in \"test/symbol/name\"",
					result == TTAddress("test/symbol/name"),
					testAssertionCount,
					errorCount);
	
	convertUpperCasedNameInAddress(testSymbolB, result);
	TTTestAssertion("convertUpperCasedName: Test passes if \"testSymbolName\" is converted in \"test/symbol/name\"",
					result == TTAddress("test/symbol/name"),
					testAssertionCount,
					errorCount);
	
	convertUpperCasedNameInAddress(testSymbolC, result);
	TTTestAssertion("convertUpperCasedName: Test passes if \"testsymbolname\" is not converted",
					result == testSymbolC,
					testAssertionCount,
					errorCount);
    
    // test TTSymbol to TTAdress casting
    TTValue     testValue = TTValue(TTSymbol("directory:/gran/parent/name.instance:attribute"));
    TTAddress   testAddress;
    
    testAddress = testValue[0];
    
    TTSymbol		directory	= testAddress.getDirectory();
	TTAddress		parent		= testAddress.getParent();
	TTSymbol		name		= testAddress.getName();
	TTSymbol		instance	= testAddress.getInstance();
	TTSymbol		attribute	= testAddress.getAttribute();
	TTAddressType	type		= testAddress.getType();
    
    TTBoolean t1 = directory == TTSymbol("directory");
    TTBoolean t2 = parent == TTAddress("/gran/parent");
    TTBoolean t3 = name == TTSymbol("name");
    TTBoolean t4 = instance == TTSymbol("instance");
    TTBoolean t5 = attribute == TTSymbol("attribute");
    TTBoolean t6 = type == kAddressAbsolute;

    TTTestAssertion("TTValue::get : Test2 fails if a TTSymbol contained into a value is not casted into a TTAddress during a get method",
					directory == TTSymbol("directory") &&
					parent == TTAddress("/gran/parent") &&
					name == TTSymbol("name") &&
					instance == TTSymbol("instance") &&
					attribute == TTSymbol("attribute") &&
					type == kAddressAbsolute,
					testAssertionCount,
					errorCount);

    // test TTSymbol for TTHash access when a key is stored using a TTAddress
    TTHash      testTable;
    TTAddress   keyAddress = TTAddress("testKeyAddress");
    TTValue     keyValue;
    TTErr       err;
    
    testTable.append(keyAddress, keyValue);             // store a value into the table using "testKeyAddress" address
    testValue = TTValue(TTSymbol("testKeyAddress"));    // store a "testKeyAddress" symbol into a value
    testAddress = testValue[0];                         // get it as an address
    err = testTable.lookup(testAddress, keyValue);      // use the address to lookup the table
    
    TTTestAssertion("TTHash::lookup : Test fails if a TTSymbol cannot be used as storage key for TTHash table when the lookup key is a TTAddress",
					err == kTTErrNone,
					testAssertionCount,
					errorCount);
    
    // The test below fails but it have been added only to check the opposite operation.
    // For instant we don't need this test to pass so it is commented out until we need this feature.
    
    /* test TTAddress for TTHash access when a key is stored using a TTSymbol
    TTSymbol    keySymbol = TTSymbol("testKeySymbol");
    TTSymbol    testSymbol;
    
    testTable.append(keySymbol, keyValue);              // store a value into the table using "testKeySymbol" symbol
    testValue = TTValue(TTAddress("testKeySymbol"));    // store a "testKeySymbol" address into a value
    testSymbol = testValue[0];                          // get it as an symbol
    err = testTable.lookup(testSymbol, keyValue);       // use the symbol to lookup the table
    
    TTTestAssertion("TTHash::lookup : Test fails if a TTAddress cannot be used as storage key for TTHash table when the lookup key is a TTSymbol",
					err == kTTErrNone,
					testAssertionCount,
					errorCount);
     */
}
开发者ID:aprigent,项目名称:JamomaCore,代码行数:94,代码来源:TTNodeLib.test.cpp


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