assetQuery_ScriptBinding.h
Engine/source/assets/assetQuery_ScriptBinding.h
Public Functions
DefineEngineMethod(AssetQuery , clear , void , () , "Clears all asset Id results." "Clears all asset Id <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">results.\n</a>" "@return () No return <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value.\n</a>" )
DefineEngineMethod(AssetQuery , getAsset , const char * , (S32 resultIndex) , (-1) , "Gets the asset Id at the specified query result <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@param resultIndex The query result index <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n</a>" "@return (assetId)The asset Id at the specified index or <a href="/coding/file/typesx86unix_8h/#typesx86unix_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> not <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">valid.\n</a>" )
DefineEngineMethod(AssetQuery , getCount , S32 , () , "Gets the <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1ad43c3812e6d13e0518d9f8b8f463ffcf">count</a> of asset Id <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">results.\n</a>" "@return (int)The <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1ad43c3812e6d13e0518d9f8b8f463ffcf">count</a> of asset Id <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">results.\n</a>" )
DefineEngineMethod(AssetQuery , set , bool , (S32 queryId) , "Sets the asset query <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> copy of the specified asset <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query.\n</a>" "@param assetQuery The asset query <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">copy.\n</a>" "@return Whether the operation succeeded or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" )
Detailed Description
Public Functions
DefineEngineMethod(AssetQuery , clear , void , () , "Clears all asset Id results." "Clears all asset Id <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">results.\n</a>" "@return () No return <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value.\n</a>" )
DefineEngineMethod(AssetQuery , getAsset , const char * , (S32 resultIndex) , (-1) , "Gets the asset Id at the specified query result <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@param resultIndex The query result index <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n</a>" "@return (assetId)The asset Id at the specified index or <a href="/coding/file/typesx86unix_8h/#typesx86unix_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> not <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">valid.\n</a>" )
DefineEngineMethod(AssetQuery , getCount , S32 , () , "Gets the <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1ad43c3812e6d13e0518d9f8b8f463ffcf">count</a> of asset Id <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">results.\n</a>" "@return (int)The <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1ad43c3812e6d13e0518d9f8b8f463ffcf">count</a> of asset Id <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">results.\n</a>" )
DefineEngineMethod(AssetQuery , set , bool , (S32 queryId) , "Sets the asset query <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> copy of the specified asset <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query.\n</a>" "@param assetQuery The asset query <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">copy.\n</a>" "@return Whether the operation succeeded or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" )
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2013 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _ASSET_QUERY_H_ 25#include "assets/assetQuery.h" 26#endif 27 28#include "console/engineAPI.h" 29 30DefineEngineMethod(AssetQuery, clear, void, (),,"Clears all asset Id results." 31 "Clears all asset Id results.\n" 32 "@return () No return value.\n") 33{ 34 object->mAssetList.clear(); 35} 36 37//----------------------------------------------------------------------------- 38 39 40DefineEngineMethod(AssetQuery, set, bool, (S32 queryId), , 41 "Sets the asset query to a copy of the specified asset query.\n" 42 "@param assetQuery The asset query to copy.\n" 43 "@return Whether the operation succeeded or not.\n") 44{ 45 // Find asset query. 46 AssetQuery* pAssetQuery; 47 48 if (!Sim::findObject(queryId, pAssetQuery)) 49 { 50 // No, so warn. 51 Con::warnf("AssetQuery::set() - Could not find asset query '%i'.", queryId); 52 return false; 53 } 54 55 // Set asset query. 56 object->set( *pAssetQuery ); 57 58 return true; 59} 60 61//----------------------------------------------------------------------------- 62 63DefineEngineMethod(AssetQuery, getCount, S32, (), , 64 "Gets the count of asset Id results.\n" 65 "@return (int)The count of asset Id results.\n") 66{ 67 return object->mAssetList.size(); 68} 69 70//----------------------------------------------------------------------------- 71 72DefineEngineMethod(AssetQuery, getAsset, const char*, (S32 resultIndex), (-1), 73 "Gets the asset Id at the specified query result index.\n" 74 "@param resultIndex The query result index to use.\n" 75 "@return (assetId)The asset Id at the specified index or NULL if not valid.\n") 76{ 77 // Is index within bounds? 78 if (resultIndex >= object->mAssetList.size()) 79 { 80 // No, so warn. 81 Con::warnf("AssetQuery::getAsset() - Result index '%s' is out of bounds.", resultIndex); 82 return StringTable->EmptyString(); 83 } 84 85 return object->mAssetList[resultIndex]; 86} 87