diff options
author | Richard Linden <none@none> | 2013-07-30 19:13:45 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2013-07-30 19:13:45 -0700 |
commit | a2e22732f195dc075a733c79f15156752f522a43 (patch) | |
tree | c708db3a28ae578b3b6d8f1cc94935937efd9a1e /indra/llcommon | |
parent | 19f7fb6ccce52224cc067e496d1480191badb165 (diff) |
Summer cleaning - removed a lot of llcommon dependencies to speed up build times
consolidated most indra-specific constants in llcommon under indra_constants.h
fixed issues with operations on mixed unit types (implicit and explicit)
made LL_INFOS() style macros variadic in order to subsume other logging methods
such as ll_infos
added optional tag output to error recorders
Diffstat (limited to 'indra/llcommon')
57 files changed, 788 insertions, 5180 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 0c76fd46c0..4336550d07 100755 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -26,22 +26,20 @@ include_directories( # ${LLCOMMON_LIBRARIES}) set(llcommon_SOURCE_FILES - imageids.cpp indra_constants.cpp llallocator.cpp llallocator_heap_profile.cpp llapp.cpp llapr.cpp llassettype.cpp - llavatarname.cpp llbase32.cpp llbase64.cpp + llbitpack.cpp llcommon.cpp llcommonutils.cpp llcoros.cpp llcrc.cpp llcriticaldamp.cpp - llcursortypes.cpp lldate.cpp lldependencies.cpp lldictionary.cpp @@ -58,7 +56,6 @@ set(llcommon_SOURCE_FILES llfile.cpp llfindlocale.cpp llfixedbuffer.cpp - llfoldertype.cpp llformat.cpp llframetimer.cpp llheartbeat.cpp @@ -68,7 +65,6 @@ set(llcommon_SOURCE_FILES llleaplistener.cpp llliveappconfig.cpp lllivefile.cpp - lllog.cpp llmd5.cpp llmemory.cpp llmemorystream.cpp @@ -76,7 +72,6 @@ set(llcommon_SOURCE_FILES llmetricperformancetester.cpp llmortician.cpp llmutex.cpp - lloptioninterface.cpp llptrto.cpp llpredicate.cpp llprocess.cpp @@ -90,7 +85,6 @@ set(llcommon_SOURCE_FILES llsdserialize.cpp llsdserialize_xml.cpp llsdutil.cpp - llsecondlifeurls.cpp llsingleton.cpp llstacktrace.cpp llstreamqueue.cpp @@ -116,45 +110,33 @@ set(llcommon_SOURCE_FILES set(llcommon_HEADER_FILES CMakeLists.txt - bitpack.h ctype_workaround.h fix_macros.h - imageids.h indra_constants.h linden_common.h - linked_lists.h - llaccountingcost.h llallocator.h llallocator_heap_profile.h - llagentconstants.h - llavatarname.h llapp.h llapr.h llassettype.h - llavatarconstants.h llbase32.h llbase64.h + llbitpack.h llboost.h - llchat.h - llclickaction.h llcommon.h llcommonutils.h llcoros.h llcrc.h llcriticaldamp.h - llcursortypes.h - lldarray.h lldate.h lldefs.h lldependencies.h - lldeleteutils.h lldepthstack.h lldictionary.h lldoubledispatch.h llendianswizzle.h llerror.h llerrorcontrol.h - llerrorlegacy.h llerrorthread.h llevent.h lleventapi.h @@ -163,30 +145,25 @@ set(llcommon_HEADER_FILES lleventfilter.h llevents.h lleventemitter.h - llextendedstatus.h llfasttimer.h llfile.h llfindlocale.h llfixedbuffer.h - llfoldertype.h llformat.h llframetimer.h llhandle.h llhash.h llheartbeat.h llhttpstatuscodes.h + llindexedvector.h llinitparam.h llinstancetracker.h llkeythrottle.h llleap.h llleaplistener.h lllistenerwrapper.h - lllinkedqueue.h llliveappconfig.h lllivefile.h - lllog.h - lllslconstants.h - llmap.h llmd5.h llmemory.h llmemorystream.h @@ -194,8 +171,6 @@ set(llcommon_HEADER_FILES llmetricperformancetester.h llmortician.h llmutex.h - llnametable.h - lloptioninterface.h llpointer.h llpredicate.h llpreprocessor.h @@ -215,11 +190,9 @@ set(llcommon_HEADER_FILES llsdserialize.h llsdserialize_xml.h llsdutil.h - llsecondlifeurls.h llsimplehash.h llsingleton.h llstacktrace.h - llstatenums.h llstl.h llstreamqueue.h llstreamtools.h @@ -239,18 +212,12 @@ set(llcommon_HEADER_FILES llunit.h lluri.h lluuid.h - llversionserver.h llwin32headers.h llwin32headerslean.h llworkerthread.h - ll_template_cast.h - roles_constants.h - stdenums.h stdtypes.h - string_table.h stringize.h timer.h - timing.h u64.h ) diff --git a/indra/llcommon/imageids.cpp b/indra/llcommon/imageids.cpp deleted file mode 100755 index 7d647e5c36..0000000000 --- a/indra/llcommon/imageids.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @file imageids.cpp - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "imageids.h" - -#include "lluuid.h" - -// -// USE OF THIS FILE IS DEPRECATED -// -// Please use viewerart.ini and the standard -// art import path. // indicates if file is only - // on dataserver, or also - // pre-cached on viewer - -// Grass Images -const LLUUID IMG_SMOKE ("b4ba225c-373f-446d-9f7e-6cb7b5cf9b3d"); // VIEWER - -const LLUUID IMG_DEFAULT ("d2114404-dd59-4a4d-8e6c-49359e91bbf0"); // VIEWER - -const LLUUID IMG_SUN ("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver -const LLUUID IMG_MOON ("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver -const LLUUID IMG_CLOUD_POOF ("fc4b9f0b-d008-45c6-96a4-01dd947ac621"); // dataserver -const LLUUID IMG_SHOT ("35f217a3-f618-49cf-bbca-c86d486551a9"); // dataserver -const LLUUID IMG_SPARK ("d2e75ac1-d0fb-4532-820e-a20034ac814d"); // dataserver -const LLUUID IMG_FIRE ("aca40aa8-44cf-44ca-a0fa-93e1a2986f82"); // dataserver -const LLUUID IMG_FACE_SELECT ("a85ac674-cb75-4af6-9499-df7c5aaf7a28"); // face selector -const LLUUID IMG_DEFAULT_AVATAR ("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); // dataserver -const LLUUID IMG_INVISIBLE ("3a367d1c-bef1-6d43-7595-e88c1e3aadb3"); // dataserver - -const LLUUID IMG_EXPLOSION ("68edcf47-ccd7-45b8-9f90-1649d7f12806"); // On dataserver -const LLUUID IMG_EXPLOSION_2 ("21ce046c-83fe-430a-b629-c7660ac78d7c"); // On dataserver -const LLUUID IMG_EXPLOSION_3 ("fedea30a-1be8-47a6-bc06-337a04a39c4b"); // On dataserver -const LLUUID IMG_EXPLOSION_4 ("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); // On dataserver -const LLUUID IMG_SMOKE_POOF ("1e63e323-5fe0-452e-92f8-b98bd0f764e3"); // On dataserver - -const LLUUID IMG_BIG_EXPLOSION_1 ("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); // On dataserver -const LLUUID IMG_BIG_EXPLOSION_2 ("9c8eca51-53d5-42a7-bb58-cef070395db8"); // On dataserver - -const LLUUID IMG_BLOOM1 ("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); // VIEWER -const LLUUID TERRAIN_DIRT_DETAIL ("0bc58228-74a0-7e83-89bc-5c23464bcec5"); // VIEWER -const LLUUID TERRAIN_GRASS_DETAIL ("63338ede-0037-c4fd-855b-015d77112fc8"); // VIEWER -const LLUUID TERRAIN_MOUNTAIN_DETAIL ("303cd381-8560-7579-23f1-f0a880799740"); // VIEWER -const LLUUID TERRAIN_ROCK_DETAIL ("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // VIEWER - -const LLUUID DEFAULT_WATER_NORMAL ("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER - -const LLUUID IMG_CHECKERBOARD_RGBA ("2585a0f3-4163-6dd1-0f34-ad48cb909e25"); // dataserver - diff --git a/indra/llcommon/imageids.h b/indra/llcommon/imageids.h deleted file mode 100755 index 18c8ecb074..0000000000 --- a/indra/llcommon/imageids.h +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @file imageids.h - * @brief Temporary holder for image IDs - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_IMAGEIDS_H -#define LL_IMAGEIDS_H - -// -// USE OF THIS FILE IS DEPRECATED -// -// Please use viewerart.ini and the standard -// art import path. - -class LLUUID; - -LL_COMMON_API extern const LLUUID IMG_SMOKE; - -LL_COMMON_API extern const LLUUID IMG_DEFAULT; - -LL_COMMON_API extern const LLUUID IMG_SUN; -LL_COMMON_API extern const LLUUID IMG_MOON; -LL_COMMON_API extern const LLUUID IMG_CLOUD_POOF; -LL_COMMON_API extern const LLUUID IMG_SHOT; -LL_COMMON_API extern const LLUUID IMG_SPARK; -LL_COMMON_API extern const LLUUID IMG_FIRE; -LL_COMMON_API extern const LLUUID IMG_FACE_SELECT; -LL_COMMON_API extern const LLUUID IMG_DEFAULT_AVATAR; -LL_COMMON_API extern const LLUUID IMG_INVISIBLE; - -LL_COMMON_API extern const LLUUID IMG_EXPLOSION; -LL_COMMON_API extern const LLUUID IMG_EXPLOSION_2; -LL_COMMON_API extern const LLUUID IMG_EXPLOSION_3; -LL_COMMON_API extern const LLUUID IMG_EXPLOSION_4; -LL_COMMON_API extern const LLUUID IMG_SMOKE_POOF; - -LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_1; -LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_2; - -LL_COMMON_API extern const LLUUID IMG_BLOOM1; -LL_COMMON_API extern const LLUUID TERRAIN_DIRT_DETAIL; -LL_COMMON_API extern const LLUUID TERRAIN_GRASS_DETAIL; -LL_COMMON_API extern const LLUUID TERRAIN_MOUNTAIN_DETAIL; -LL_COMMON_API extern const LLUUID TERRAIN_ROCK_DETAIL; - -LL_COMMON_API extern const LLUUID DEFAULT_WATER_NORMAL; - -LL_COMMON_API extern const LLUUID IMG_CHECKERBOARD_RGBA; -#endif diff --git a/indra/llcommon/indra_constants.cpp b/indra/llcommon/indra_constants.cpp index d32ae6c041..b61dca3243 100755 --- a/indra/llcommon/indra_constants.cpp +++ b/indra/llcommon/indra_constants.cpp @@ -35,6 +35,35 @@ const LLUUID LL_UUID_ALL_AGENTS("44e87126-e794-4ded-05b3-7c42da3d5cdb"); // Governor Linden's agent id. const LLUUID ALEXANDRIA_LINDEN_ID("ba2a564a-f0f1-4b82-9c61-b7520bfcd09f"); const LLUUID GOVERNOR_LINDEN_ID("3d6181b0-6a4b-97ef-18d8-722652995cf1"); -const LLUUID REALESTATE_LINDEN_ID("3d6181b0-6a4b-97ef-18d8-722652995cf1"); // Maintenance's group id. const LLUUID MAINTENANCE_GROUP_ID("dc7b21cd-3c89-fcaa-31c8-25f9ffd224cd"); +// Grass Images +const LLUUID IMG_SMOKE ("b4ba225c-373f-446d-9f7e-6cb7b5cf9b3d"); // VIEWER + +const LLUUID IMG_DEFAULT ("d2114404-dd59-4a4d-8e6c-49359e91bbf0"); // VIEWER + +const LLUUID IMG_SUN ("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver +const LLUUID IMG_MOON ("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver +const LLUUID IMG_SHOT ("35f217a3-f618-49cf-bbca-c86d486551a9"); // dataserver +const LLUUID IMG_SPARK ("d2e75ac1-d0fb-4532-820e-a20034ac814d"); // dataserver +const LLUUID IMG_FIRE ("aca40aa8-44cf-44ca-a0fa-93e1a2986f82"); // dataserver +const LLUUID IMG_FACE_SELECT ("a85ac674-cb75-4af6-9499-df7c5aaf7a28"); // face selector +const LLUUID IMG_DEFAULT_AVATAR ("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); // dataserver +const LLUUID IMG_INVISIBLE ("3a367d1c-bef1-6d43-7595-e88c1e3aadb3"); // dataserver + +const LLUUID IMG_EXPLOSION ("68edcf47-ccd7-45b8-9f90-1649d7f12806"); // On dataserver +const LLUUID IMG_EXPLOSION_2 ("21ce046c-83fe-430a-b629-c7660ac78d7c"); // On dataserver +const LLUUID IMG_EXPLOSION_3 ("fedea30a-1be8-47a6-bc06-337a04a39c4b"); // On dataserver +const LLUUID IMG_EXPLOSION_4 ("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); // On dataserver +const LLUUID IMG_SMOKE_POOF ("1e63e323-5fe0-452e-92f8-b98bd0f764e3"); // On dataserver + +const LLUUID IMG_BIG_EXPLOSION_1 ("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); // On dataserver +const LLUUID IMG_BIG_EXPLOSION_2 ("9c8eca51-53d5-42a7-bb58-cef070395db8"); // On dataserver + +const LLUUID IMG_BLOOM1 ("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); // VIEWER +const LLUUID TERRAIN_DIRT_DETAIL ("0bc58228-74a0-7e83-89bc-5c23464bcec5"); // VIEWER +const LLUUID TERRAIN_GRASS_DETAIL ("63338ede-0037-c4fd-855b-015d77112fc8"); // VIEWER +const LLUUID TERRAIN_MOUNTAIN_DETAIL ("303cd381-8560-7579-23f1-f0a880799740"); // VIEWER +const LLUUID TERRAIN_ROCK_DETAIL ("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // VIEWER + +const LLUUID DEFAULT_WATER_NORMAL ("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER
\ No newline at end of file diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index 0da83720bd..02f063f5e8 100755 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -31,122 +31,28 @@ class LLUUID; -// At 45 Hz collisions seem stable and objects seem -// to settle down at a reasonable rate. -// JC 3/18/2003 - -// const F32 PHYSICS_TIMESTEP = 1.f / 45.f; -// This must be a #define due to anal retentive restrictions on const expressions -// CG 2008-06-05 -#define PHYSICS_TIMESTEP (1.f / 45.f) - -const F32 COLLISION_TOLERANCE = 0.1f; -const F32 HALF_COLLISION_TOLERANCE = 0.05f; - -// Time constants -const U32 HOURS_PER_LINDEN_DAY = 4; -const U32 DAYS_PER_LINDEN_YEAR = 11; - -const U32 SEC_PER_LINDEN_DAY = HOURS_PER_LINDEN_DAY * 60 * 60; -const U32 SEC_PER_LINDEN_YEAR = DAYS_PER_LINDEN_YEAR * SEC_PER_LINDEN_DAY; - static const F32 REGION_WIDTH_METERS = 256.f; static const S32 REGION_WIDTH_UNITS = 256; static const U32 REGION_WIDTH_U32 = 256; const F32 REGION_HEIGHT_METERS = 4096.f; -// Bits for simulator performance query flags -enum LAND_STAT_FLAGS -{ - STAT_FILTER_BY_PARCEL = 0x00000001, - STAT_FILTER_BY_OWNER = 0x00000002, - STAT_FILTER_BY_OBJECT = 0x00000004, - STAT_FILTER_BY_PARCEL_NAME = 0x00000008, - STAT_REQUEST_LAST_ENTRY = 0x80000000, -}; - -enum LAND_STAT_REPORT_TYPE -{ - STAT_REPORT_TOP_SCRIPTS = 0, - STAT_REPORT_TOP_COLLIDERS -}; - -const U32 STAT_FILTER_MASK = 0x1FFFFFFF; - -// Region absolute limits -static const S32 REGION_AGENT_COUNT_MIN = 1; -static const S32 REGION_AGENT_COUNT_MAX = 200; // Must fit in U8 for the moment (RegionInfo msg) -static const S32 REGION_PRIM_COUNT_MIN = 0; -static const S32 REGION_PRIM_COUNT_MAX = 40000; -static const F32 REGION_PRIM_BONUS_MIN = 1.0; -static const F32 REGION_PRIM_BONUS_MAX = 10.0; - -// Default maximum number of tasks/prims per region. -const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000; - -const F32 MIN_AGENT_DEPTH = 0.30f; const F32 DEFAULT_AGENT_DEPTH = 0.45f; -const F32 MAX_AGENT_DEPTH = 0.60f; - -const F32 MIN_AGENT_WIDTH = 0.40f; const F32 DEFAULT_AGENT_WIDTH = 0.60f; -const F32 MAX_AGENT_WIDTH = 0.80f; - -const F32 MIN_AGENT_HEIGHT = 1.1f; const F32 DEFAULT_AGENT_HEIGHT = 1.9f; -const F32 MAX_AGENT_HEIGHT = 2.45f; - -// For linked sets -const S32 MAX_CHILDREN_PER_TASK = 255; -const S32 MAX_CHILDREN_PER_PHYSICAL_TASK = 32; - -const S32 MAX_JOINTS_PER_OBJECT = 1; // limiting to 1 until Havok 2.x - -const char* const DEFAULT_DMZ_SPACE_SERVER = "192.168.0.140"; -const char* const DEFAULT_DMZ_USER_SERVER = "192.168.0.140"; -const char* const DEFAULT_DMZ_DATA_SERVER = "192.168.0.140"; -const char* const DEFAULT_DMZ_ASSET_SERVER = "http://asset.dmz.lindenlab.com:80"; - -const char* const DEFAULT_AGNI_SPACE_SERVER = "63.211.139.100"; -const char* const DEFAULT_AGNI_USER_SERVER = "63.211.139.100"; -const char* const DEFAULT_AGNI_DATA_SERVER = "63.211.139.100"; -const char* const DEFAULT_AGNI_ASSET_SERVER = "http://asset.agni.lindenlab.com:80"; - -// Information about what ports are for what services is in the wiki Name Space Ports page -// https://wiki.lindenlab.com/wiki/Name_Space_Ports -const char* const DEFAULT_LOCAL_ASSET_SERVER = "http://localhost:12041/asset/tmp"; -const char* const LOCAL_ASSET_URL_FORMAT = "http://%s:12041/asset"; - -const U32 DEFAULT_LAUNCHER_PORT = 12029; -//const U32 DEFAULT_BIGBOARD_PORT = 12030; // Deprecated -//const U32 DEFAULT_QUERYSIM_PORT = 12031; // Deprecated -const U32 DEFAULT_DATA_SERVER_PORT = 12032; -const U32 DEFAULT_SPACE_SERVER_PORT = 12033; -const U32 DEFAULT_VIEWER_PORT = 12034; -const U32 DEFAULT_SIMULATOR_PORT = 12035; -const U32 DEFAULT_USER_SERVER_PORT = 12036; -const U32 DEFAULT_RPC_SERVER_PORT = 12037; -const U32 DEFAULT_LOG_DATA_SERVER_PORT = 12039; -const U32 DEFAULT_BACKBONE_PORT = 12040; -const U32 DEFAULT_LOCAL_ASSET_PORT = 12041; -//const U32 DEFAULT_BACKBONE_CAP_PORT = 12042; // Deprecated -const U32 DEFAULT_CAP_PROXY_PORT = 12043; -const U32 DEFAULT_INV_DATA_SERVER_PORT = 12044; -const U32 DEFAULT_CGI_SERVICES_PORT = 12045; - -// Mapserver uses ports 12124 - 12139 to allow multiple mapservers to run -// on a single host for map tile generation. JC -const U32 DEFAULT_MAPSERVER_PORT = 12124; - -// For automatic port discovery when running multiple viewers on one host -const U32 PORT_DISCOVERY_RANGE_MIN = 13000; -const U32 PORT_DISCOVERY_RANGE_MAX = PORT_DISCOVERY_RANGE_MIN + 50; - -const char LAND_LAYER_CODE = 'L'; -const char WATER_LAYER_CODE = 'W'; -const char WIND_LAYER_CODE = '7'; -const char CLOUD_LAYER_CODE = '8'; + +enum ETerrainBrushType +{ + // the valid brush numbers cannot be reordered, because they + // are used in the binary LSL format as arguments to llModifyLand() + E_LANDBRUSH_LEVEL = 0, + E_LANDBRUSH_RAISE = 1, + E_LANDBRUSH_LOWER = 2, + E_LANDBRUSH_SMOOTH = 3, + E_LANDBRUSH_NOISE = 4, + E_LANDBRUSH_REVERT = 5, + E_LANDBRUSH_INVALID = 6 +}; // keys // Bit masks for various keyboard modifier keys. @@ -265,89 +171,43 @@ LL_COMMON_API extern const LLUUID LL_UUID_ALL_AGENTS; LL_COMMON_API extern const LLUUID ALEXANDRIA_LINDEN_ID; LL_COMMON_API extern const LLUUID GOVERNOR_LINDEN_ID; -LL_COMMON_API extern const LLUUID REALESTATE_LINDEN_ID; // Maintenance's group id. LL_COMMON_API extern const LLUUID MAINTENANCE_GROUP_ID; -// Flags for kick message -const U32 KICK_FLAGS_DEFAULT = 0x0; -const U32 KICK_FLAGS_FREEZE = 1 << 0; -const U32 KICK_FLAGS_UNFREEZE = 1 << 1; - -const U8 UPD_NONE = 0x00; -const U8 UPD_POSITION = 0x01; -const U8 UPD_ROTATION = 0x02; -const U8 UPD_SCALE = 0x04; -const U8 UPD_LINKED_SETS = 0x08; -const U8 UPD_UNIFORM = 0x10; // used with UPD_SCALE - -// Agent Update Flags (U8) -const U8 AU_FLAGS_NONE = 0x00; -const U8 AU_FLAGS_HIDETITLE = 0x01; -const U8 AU_FLAGS_CLIENT_AUTOPILOT = 0x02; - -// start location constants -const U32 START_LOCATION_ID_LAST = 0; -const U32 START_LOCATION_ID_HOME = 1; -const U32 START_LOCATION_ID_DIRECT = 2; // for direct teleport -const U32 START_LOCATION_ID_PARCEL = 3; // for teleports to a parcel -const U32 START_LOCATION_ID_TELEHUB = 4; // for teleports to a spawnpoint -const U32 START_LOCATION_ID_URL = 5; -const U32 START_LOCATION_ID_COUNT = 6; - -// group constants -const U32 GROUP_MIN_SIZE = 2; - -// gMaxAgentGroups is now sent by login.cgi, which -// looks it up from globals.xml. -// -// For now we need an old default value however, -// so the viewer can be deployed ahead of login.cgi. -// -const S32 DEFAULT_MAX_AGENT_GROUPS = 25; +// image ids +LL_COMMON_API extern const LLUUID IMG_SMOKE; -// radius within which a chat message is fully audible -const F32 CHAT_WHISPER_RADIUS = 10.f; -const F32 CHAT_NORMAL_RADIUS = 20.f; -const F32 CHAT_SHOUT_RADIUS = 100.f; -const F32 CHAT_MAX_RADIUS = CHAT_SHOUT_RADIUS; -const F32 CHAT_MAX_RADIUS_BY_TWO = CHAT_MAX_RADIUS / 2.f; +LL_COMMON_API extern const LLUUID IMG_DEFAULT; -// squared editions of the above for distance checks -const F32 CHAT_WHISPER_RADIUS_SQUARED = CHAT_WHISPER_RADIUS * CHAT_WHISPER_RADIUS; -const F32 CHAT_NORMAL_RADIUS_SQUARED = CHAT_NORMAL_RADIUS * CHAT_NORMAL_RADIUS; -const F32 CHAT_SHOUT_RADIUS_SQUARED = CHAT_SHOUT_RADIUS * CHAT_SHOUT_RADIUS; -const F32 CHAT_MAX_RADIUS_SQUARED = CHAT_SHOUT_RADIUS_SQUARED; -const F32 CHAT_MAX_RADIUS_BY_TWO_SQUARED = CHAT_MAX_RADIUS_BY_TWO * CHAT_MAX_RADIUS_BY_TWO; +LL_COMMON_API extern const LLUUID IMG_SUN; +LL_COMMON_API extern const LLUUID IMG_MOON; +LL_COMMON_API extern const LLUUID IMG_SHOT; +LL_COMMON_API extern const LLUUID IMG_SPARK; +LL_COMMON_API extern const LLUUID IMG_FIRE; +LL_COMMON_API extern const LLUUID IMG_FACE_SELECT; +LL_COMMON_API extern const LLUUID IMG_DEFAULT_AVATAR; +LL_COMMON_API extern const LLUUID IMG_INVISIBLE; +LL_COMMON_API extern const LLUUID IMG_EXPLOSION; +LL_COMMON_API extern const LLUUID IMG_EXPLOSION_2; +LL_COMMON_API extern const LLUUID IMG_EXPLOSION_3; +LL_COMMON_API extern const LLUUID IMG_EXPLOSION_4; +LL_COMMON_API extern const LLUUID IMG_SMOKE_POOF; -// this times above gives barely audible radius -const F32 CHAT_BARELY_AUDIBLE_FACTOR = 2.0f; +LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_1; +LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_2; -// distance in front of speaking agent the sphere is centered -const F32 CHAT_WHISPER_OFFSET = 5.f; -const F32 CHAT_NORMAL_OFFSET = 10.f; -const F32 CHAT_SHOUT_OFFSET = 50.f; +LL_COMMON_API extern const LLUUID IMG_BLOOM1; +LL_COMMON_API extern const LLUUID TERRAIN_DIRT_DETAIL; +LL_COMMON_API extern const LLUUID TERRAIN_GRASS_DETAIL; +LL_COMMON_API extern const LLUUID TERRAIN_MOUNTAIN_DETAIL; +LL_COMMON_API extern const LLUUID TERRAIN_ROCK_DETAIL; -// first clean starts at 3 AM -const S32 SANDBOX_FIRST_CLEAN_HOUR = 3; -// clean every <n> hours -const S32 SANDBOX_CLEAN_FREQ = 12; +LL_COMMON_API extern const LLUUID DEFAULT_WATER_NORMAL; -const F32 WIND_SCALE_HACK = 2.0f; // hack to make wind speeds more realistic -enum ETerrainBrushType -{ - // the valid brush numbers cannot be reordered, because they - // are used in the binary LSL format as arguments to llModifyLand() - E_LANDBRUSH_LEVEL = 0, - E_LANDBRUSH_RAISE = 1, - E_LANDBRUSH_LOWER = 2, - E_LANDBRUSH_SMOOTH = 3, - E_LANDBRUSH_NOISE = 4, - E_LANDBRUSH_REVERT = 5, - E_LANDBRUSH_INVALID = 6 -}; +// radius within which a chat message is fully audible +const F32 CHAT_NORMAL_RADIUS = 20.f; // media commands const U32 PARCEL_MEDIA_COMMAND_STOP = 0; @@ -365,51 +225,101 @@ const U32 PARCEL_MEDIA_COMMAND_SIZE = 11; const U32 PARCEL_MEDIA_COMMAND_DESC = 12; const U32 PARCEL_MEDIA_COMMAND_LOOP_SET = 13; -// map item types -const U32 MAP_ITEM_TELEHUB = 0x01; -const U32 MAP_ITEM_PG_EVENT = 0x02; -const U32 MAP_ITEM_MATURE_EVENT = 0x03; -//const U32 MAP_ITEM_POPULAR = 0x04; // No longer supported, 2009-03-02 KLW -//const U32 MAP_ITEM_AGENT_COUNT = 0x05; -const U32 MAP_ITEM_AGENT_LOCATIONS = 0x06; -const U32 MAP_ITEM_LAND_FOR_SALE = 0x07; -const U32 MAP_ITEM_CLASSIFIED = 0x08; -const U32 MAP_ITEM_ADULT_EVENT = 0x09; -const U32 MAP_ITEM_LAND_FOR_SALE_ADULT = 0x0a; - -// Region map layer numbers -const S32 MAP_SIM_OBJECTS = 0; -const S32 MAP_SIM_TERRAIN = 1; -const S32 MAP_SIM_LAND_FOR_SALE = 2; // Transparent alpha overlay of land for sale -const S32 MAP_SIM_IMAGE_TYPES = 3; // Number of map layers -const S32 MAP_SIM_INFO_MASK = 0x00FFFFFF; // Agent access may be stuffed into upper byte -const S32 MAP_SIM_LAYER_MASK = 0x0000FFFF; // Layer info is in lower 16 bits -const S32 MAP_SIM_RETURN_NULL_SIMS = 0x00010000; -const S32 MAP_SIM_PRELUDE = 0x00020000; - -// Crash reporter behavior -const S32 CRASH_BEHAVIOR_ASK = 0; -const S32 CRASH_BEHAVIOR_ALWAYS_SEND = 1; -const S32 CRASH_BEHAVIOR_NEVER_SEND = 2; - -// Export/Import return values -const S32 EXPORT_SUCCESS = 0; -const S32 EXPORT_ERROR_PERMISSIONS = -1; -const S32 EXPORT_ERROR_UNKNOWN = -2; - -// This is how long the sim will try to teleport you before giving up. -const F32 TELEPORT_EXPIRY = 15.0f; -// Additional time (in seconds) to wait per attachment -const F32 TELEPORT_EXPIRY_PER_ATTACHMENT = 3.f; - -// The maximum size of an object extra parameters binary (packed) block -#define MAX_OBJECT_PARAMS_SIZE 1024 - const S32 CHAT_CHANNEL_DEBUG = S32_MAX; -// PLEASE don't add constants here. Every dev will have to do -// a complete rebuild. Try to find another shared header file, -// like llregionflags.h, lllslconstants.h, llagentconstants.h, -// or create a new one. JC +// agent constants +const U32 CONTROL_AT_POS_INDEX = 0; +const U32 CONTROL_AT_NEG_INDEX = 1; +const U32 CONTROL_LEFT_POS_INDEX = 2; +const U32 CONTROL_LEFT_NEG_INDEX = 3; +const U32 CONTROL_UP_POS_INDEX = 4; +const U32 CONTROL_UP_NEG_INDEX = 5; +const U32 CONTROL_PITCH_POS_INDEX = 6; +const U32 CONTROL_PITCH_NEG_INDEX = 7; +const U32 CONTROL_YAW_POS_INDEX = 8; +const U32 CONTROL_YAW_NEG_INDEX = 9; +const U32 CONTROL_FAST_AT_INDEX = 10; +const U32 CONTROL_FAST_LEFT_INDEX = 11; +const U32 CONTROL_FAST_UP_INDEX = 12; +const U32 CONTROL_FLY_INDEX = 13; +const U32 CONTROL_STOP_INDEX = 14; +const U32 CONTROL_FINISH_ANIM_INDEX = 15; +const U32 CONTROL_STAND_UP_INDEX = 16; +const U32 CONTROL_SIT_ON_GROUND_INDEX = 17; +const U32 CONTROL_MOUSELOOK_INDEX = 18; +const U32 CONTROL_NUDGE_AT_POS_INDEX = 19; +const U32 CONTROL_NUDGE_AT_NEG_INDEX = 20; +const U32 CONTROL_NUDGE_LEFT_POS_INDEX = 21; +const U32 CONTROL_NUDGE_LEFT_NEG_INDEX = 22; +const U32 CONTROL_NUDGE_UP_POS_INDEX = 23; +const U32 CONTROL_NUDGE_UP_NEG_INDEX = 24; +const U32 CONTROL_TURN_LEFT_INDEX = 25; +const U32 CONTROL_TURN_RIGHT_INDEX = 26; +const U32 CONTROL_AWAY_INDEX = 27; +const U32 CONTROL_LBUTTON_DOWN_INDEX = 28; +const U32 CONTROL_LBUTTON_UP_INDEX = 29; +const U32 CONTROL_ML_LBUTTON_DOWN_INDEX = 30; +const U32 CONTROL_ML_LBUTTON_UP_INDEX = 31; +const U32 TOTAL_CONTROLS = 32; + +const U32 AGENT_CONTROL_AT_POS = 0x1 << CONTROL_AT_POS_INDEX; // 0x00000001 +const U32 AGENT_CONTROL_AT_NEG = 0x1 << CONTROL_AT_NEG_INDEX; // 0x00000002 +const U32 AGENT_CONTROL_LEFT_POS = 0x1 << CONTROL_LEFT_POS_INDEX; // 0x00000004 +const U32 AGENT_CONTROL_LEFT_NEG = 0x1 << CONTROL_LEFT_NEG_INDEX; // 0x00000008 +const U32 AGENT_CONTROL_UP_POS = 0x1 << CONTROL_UP_POS_INDEX; // 0x00000010 +const U32 AGENT_CONTROL_UP_NEG = 0x1 << CONTROL_UP_NEG_INDEX; // 0x00000020 +const U32 AGENT_CONTROL_PITCH_POS = 0x1 << CONTROL_PITCH_POS_INDEX; // 0x00000040 +const U32 AGENT_CONTROL_PITCH_NEG = 0x1 << CONTROL_PITCH_NEG_INDEX; // 0x00000080 +const U32 AGENT_CONTROL_YAW_POS = 0x1 << CONTROL_YAW_POS_INDEX; // 0x00000100 +const U32 AGENT_CONTROL_YAW_NEG = 0x1 << CONTROL_YAW_NEG_INDEX; // 0x00000200 + +const U32 AGENT_CONTROL_FAST_AT = 0x1 << CONTROL_FAST_AT_INDEX; // 0x00000400 +const U32 AGENT_CONTROL_FAST_LEFT = 0x1 << CONTROL_FAST_LEFT_INDEX; // 0x00000800 +const U32 AGENT_CONTROL_FAST_UP = 0x1 << CONTROL_FAST_UP_INDEX; // 0x00001000 + +const U32 AGENT_CONTROL_FLY = 0x1 << CONTROL_FLY_INDEX; // 0x00002000 +const U32 AGENT_CONTROL_STOP = 0x1 << CONTROL_STOP_INDEX; // 0x00004000 +const U32 AGENT_CONTROL_FINISH_ANIM = 0x1 << CONTROL_FINISH_ANIM_INDEX; // 0x00008000 +const U32 AGENT_CONTROL_STAND_UP = 0x1 << CONTROL_STAND_UP_INDEX; // 0x00010000 +const U32 AGENT_CONTROL_SIT_ON_GROUND = 0x1 << CONTROL_SIT_ON_GROUND_INDEX; // 0x00020000 +const U32 AGENT_CONTROL_MOUSELOOK = 0x1 << CONTROL_MOUSELOOK_INDEX; // 0x00040000 + +const U32 AGENT_CONTROL_NUDGE_AT_POS = 0x1 << CONTROL_NUDGE_AT_POS_INDEX; // 0x00080000 +const U32 AGENT_CONTROL_NUDGE_AT_NEG = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX; // 0x00100000 +const U32 AGENT_CONTROL_NUDGE_LEFT_POS = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX; // 0x00200000 +const U32 AGENT_CONTROL_NUDGE_LEFT_NEG = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX; // 0x00400000 +const U32 AGENT_CONTROL_NUDGE_UP_POS = 0x1 << CONTROL_NUDGE_UP_POS_INDEX; // 0x00800000 +const U32 AGENT_CONTROL_NUDGE_UP_NEG = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX; // 0x01000000 +const U32 AGENT_CONTROL_TURN_LEFT = 0x1 << CONTROL_TURN_LEFT_INDEX; // 0x02000000 +const U32 AGENT_CONTROL_TURN_RIGHT = 0x1 << CONTROL_TURN_RIGHT_INDEX; // 0x04000000 + +const U32 AGENT_CONTROL_AWAY = 0x1 << CONTROL_AWAY_INDEX; // 0x08000000 + +const U32 AGENT_CONTROL_LBUTTON_DOWN = 0x1 << CONTROL_LBUTTON_DOWN_INDEX; // 0x10000000 +const U32 AGENT_CONTROL_LBUTTON_UP = 0x1 << CONTROL_LBUTTON_UP_INDEX; // 0x20000000 +const U32 AGENT_CONTROL_ML_LBUTTON_DOWN = 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX; // 0x40000000 +const U32 AGENT_CONTROL_ML_LBUTTON_UP = ((U32)0x1) << CONTROL_ML_LBUTTON_UP_INDEX; // 0x80000000 + +// move these up so that we can hide them in "State" for object updates +// (for now) +const U32 AGENT_ATTACH_OFFSET = 4; +const U32 AGENT_ATTACH_MASK = 0xf << AGENT_ATTACH_OFFSET; + +// RN: this method swaps the upper and lower nibbles to maintain backward +// compatibility with old objects that only used the upper nibble +#define ATTACHMENT_ID_FROM_STATE(state) ((S32)((((U8)state & AGENT_ATTACH_MASK) >> 4) | (((U8)state & ~AGENT_ATTACH_MASK) << 4))) + +// DO NOT CHANGE THE SEQUENCE OF THIS LIST!! +const U8 CLICK_ACTION_NONE = 0; +const U8 CLICK_ACTION_TOUCH = 0; +const U8 CLICK_ACTION_SIT = 1; +const U8 CLICK_ACTION_BUY = 2; +const U8 CLICK_ACTION_PAY = 3; +const U8 CLICK_ACTION_OPEN = 4; +const U8 CLICK_ACTION_PLAY = 5; +const U8 CLICK_ACTION_OPEN_MEDIA = 6; +const U8 CLICK_ACTION_ZOOM = 7; +// DO NOT CHANGE THE SEQUENCE OF THIS LIST!! + #endif diff --git a/indra/llcommon/linked_lists.h b/indra/llcommon/linked_lists.h deleted file mode 100755 index 6b25295b7b..0000000000 --- a/indra/llcommon/linked_lists.h +++ /dev/null @@ -1,937 +0,0 @@ -/** - * @file linked_lists.h - * @brief LLLinkedList class header amd implementation file. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LINKED_LISTS_H -#define LL_LINKED_LISTS_H - -/** - * Provides a standard doubly linked list for fun and profit - * Utilizes a neat trick off of Flipcode where the back pointer is a - * pointer to a pointer, allowing easier transfer of nodes between lists, &c - * And a template class, of course - */ - -#include "llerror.h" - - -template <class DATA_TYPE> class LLLinkedList -{ -public: - friend class LLLinkNode; - // External interface - - // basic constructor - LLLinkedList() : mHead(NULL), mCurrentp(NULL), mInsertBefore(NULL) - { - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - mCount = 0; - } - - // basic constructor - LLLinkedList(BOOL (*insert_before)(DATA_TYPE *data_new, DATA_TYPE *data_tested)) : mHead(NULL), mCurrentp(NULL), mInsertBefore(insert_before) - { - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - mCount = 0; - } - - // destructor destroys list and nodes, but not data in nodes - ~LLLinkedList() - { - removeAllNodes(); - } - - // set mInsertBefore - void setInsertBefore(BOOL (*insert_before)(DATA_TYPE *data_new, DATA_TYPE *data_tested)) - { - mInsertBefore = insert_before; - } - - // - // WARNING!!!!!!! - // addData and addDataSorted are NOT O(1) operations, but O(n) because they check - // for existence of the data in the linked list first. Why, I don't know - djs - // If you don't care about dupes, use addDataNoCheck - // - - // put data into a node and stick it at the front of the list - inline BOOL addData(DATA_TYPE *data); - - // put data into a node and sort into list by mInsertBefore() - // calls normal add if mInsertBefore isn't set - inline BOOL addDataSorted(DATA_TYPE *data); - - inline BOOL addDataNoCheck(DATA_TYPE *data); - - // bubbleSortList - // does an improved bubble sort of the list . . . works best with almost sorted data - // does nothing if mInsertBefore isn't set - // Nota Bene: Swaps are accomplished by swapping data pointers - inline void bubbleSortList(); - - // put data into a node and stick it at the end of the list - inline BOOL addDataAtEnd(DATA_TYPE *data); - - // returns number of items in the list - inline S32 getLength() const; - - inline BOOL isEmpty(); - - // search the list starting at mHead.mNextp and remove the link with mDatap == data - // leave mCurrentp and mCurrentOperatingp on the next entry - // return TRUE if found, FALSE if not found - inline BOOL removeData(DATA_TYPE *data); - - // search the list starting at mHead.mNextp and delete the link with mDatap == data - // leave mCurrentp and mCurrentOperatingp on the next entry - // return TRUE if found, FALSE if not found - inline BOOL deleteData(DATA_TYPE *data); - - // remove all nodes from the list and delete the associated data - inline void deleteAllData(); - - // remove all nodes from the list but do not delete data - inline void removeAllNodes(); - - // check to see if data is in list - // if TRUE then mCurrentp and mCurrentOperatingp point to data - inline BOOL checkData(DATA_TYPE *data); - - // place mCurrentp on first node - inline void resetList(); - - // return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp - inline DATA_TYPE *getCurrentData(); - - // same as getCurrentData() but a more intuitive name for the operation - inline DATA_TYPE *getNextData(); - - // reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp - inline DATA_TYPE *getFirstData(); - - // reset the list and return the data at position n, set mCurentOperatingp to that node and bump mCurrentp - // Note: n is zero-based - inline DATA_TYPE *getNthData( U32 n); - - // reset the list and return the last data in it, set mCurentOperatingp to that node and bump mCurrentp - inline DATA_TYPE *getLastData(); - - // remove the Node at mCurentOperatingp - // leave mCurrentp and mCurentOperatingp on the next entry - inline void removeCurrentData(); - - // remove the Node at mCurentOperatingp and add it to newlist - // leave mCurrentp and mCurentOperatingp on the next entry - void moveCurrentData(LLLinkedList *newlist, BOOL b_sort); - - BOOL moveData(DATA_TYPE *data, LLLinkedList *newlist, BOOL b_sort); - - // delete the Node at mCurentOperatingp - // leave mCurrentp anf mCurentOperatingp on the next entry - void deleteCurrentData(); - -private: - // node that actually contains the data - class LLLinkNode - { - public: - // assign the mDatap pointer - LLLinkNode(DATA_TYPE *data) : mDatap(data), mNextp(NULL), mPrevpp(NULL) - { - } - - // destructor does not, by default, destroy associated data - // however, the mDatap must be NULL to ensure that we aren't causing memory leaks - ~LLLinkNode() - { - if (mDatap) - { - llerror("Attempting to call LLLinkNode destructor with a non-null mDatap!", 1); - } - } - - // delete associated data and NULL out pointer - void deleteData() - { - delete mDatap; - mDatap = NULL; - } - - // NULL out pointer - void removeData() - { - mDatap = NULL; - } - - DATA_TYPE *mDatap; - LLLinkNode *mNextp; - LLLinkNode **mPrevpp; - }; - - // add a node at the front of the list - void addData(LLLinkNode *node) - { - // don't allow NULL to be passed to addData - if (!node) - { - llerror("NULL pointer passed to LLLinkedList::addData", 0); - } - - // add the node to the front of the list - node->mPrevpp = &mHead.mNextp; - node->mNextp = mHead.mNextp; - - // if there's something in the list, fix its back pointer - if (node->mNextp) - { - node->mNextp->mPrevpp = &node->mNextp; - } - - mHead.mNextp = node; - } - - LLLinkNode mHead; // fake head node. . . makes pointer operations faster and easier - LLLinkNode *mCurrentp; // mCurrentp is the Node that getCurrentData returns - LLLinkNode *mCurrentOperatingp; // this is the node that the various mumbleCurrentData functions act on - BOOL (*mInsertBefore)(DATA_TYPE *data_new, DATA_TYPE *data_tested); // user function set to allow sorted lists - U32 mCount; -}; - -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::addData(DATA_TYPE *data) -{ - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::addData", 0); - } - - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - if ( checkData(data)) - { - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return FALSE; - } - - // make the new node - LLLinkNode *temp = new LLLinkNode(data); - - // add the node to the front of the list - temp->mPrevpp = &mHead.mNextp; - temp->mNextp = mHead.mNextp; - - // if there's something in the list, fix its back pointer - if (temp->mNextp) - { - temp->mNextp->mPrevpp = &temp->mNextp; - } - - mHead.mNextp = temp; - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - mCount++; - return TRUE; -} - - -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::addDataNoCheck(DATA_TYPE *data) -{ - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::addData", 0); - } - - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - // make the new node - LLLinkNode *temp = new LLLinkNode(data); - - // add the node to the front of the list - temp->mPrevpp = &mHead.mNextp; - temp->mNextp = mHead.mNextp; - - // if there's something in the list, fix its back pointer - if (temp->mNextp) - { - temp->mNextp->mPrevpp = &temp->mNextp; - } - - mHead.mNextp = temp; - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - mCount++; - return TRUE; -} - - -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::addDataSorted(DATA_TYPE *data) -{ - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::addDataSorted", 0); - } - - if (checkData(data)) - { - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return FALSE; - } - - // mInsertBefore not set? - if (!mInsertBefore) - { - addData(data); - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return FALSE; - } - - // empty list? - if (!mHead.mNextp) - { - addData(data); - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return TRUE; - } - - // make the new node - LLLinkNode *temp = new LLLinkNode(data); - - // walk the list until mInsertBefore returns true - mCurrentp = mHead.mNextp; - while (mCurrentp->mNextp) - { - if (mInsertBefore(data, mCurrentp->mDatap)) - { - // insert before the current one - temp->mPrevpp = mCurrentp->mPrevpp; - temp->mNextp = mCurrentp; - *(temp->mPrevpp) = temp; - mCurrentp->mPrevpp = &temp->mNextp; - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - mCount++; - return TRUE; - } - else - { - mCurrentp = mCurrentp->mNextp; - } - } - - // on the last element, add before? - if (mInsertBefore(data, mCurrentp->mDatap)) - { - // insert before the current one - temp->mPrevpp = mCurrentp->mPrevpp; - temp->mNextp = mCurrentp; - *(temp->mPrevpp) = temp; - mCurrentp->mPrevpp = &temp->mNextp; - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - } - else // insert after - { - temp->mPrevpp = &mCurrentp->mNextp; - temp->mNextp = NULL; - mCurrentp->mNextp = temp; - - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - } - mCount++; - return TRUE; -} - -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::bubbleSortList() -{ - // mInsertBefore not set - if (!mInsertBefore) - { - return; - } - - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - BOOL b_swapped = FALSE; - DATA_TYPE *temp; - - // Nota Bene: This will break if more than 0x7FFFFFFF members in list! - S32 length = 0x7FFFFFFF; - S32 count = 0; - do - { - b_swapped = FALSE; - mCurrentp = mHead.mNextp; - count = 0; - while ( (count + 1 < length) - &&(mCurrentp)) - { - if (mCurrentp->mNextp) - { - if (!mInsertBefore(mCurrentp->mDatap, mCurrentp->mNextp->mDatap)) - { - // swap data pointers! - temp = mCurrentp->mDatap; - mCurrentp->mDatap = mCurrentp->mNextp->mDatap; - mCurrentp->mNextp->mDatap = temp; - b_swapped = TRUE; - } - } - else - { - break; - } - count++; - mCurrentp = mCurrentp->mNextp; - } - length = count; - } while (b_swapped); - - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; -} - - -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::addDataAtEnd(DATA_TYPE *data) -{ - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::addData", 0); - } - - if (checkData(data)) - { - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return FALSE; - } - - // make the new node - LLLinkNode *temp = new LLLinkNode(data); - - // add the node to the end of the list - - // if empty, add to the front and be done with it - if (!mHead.mNextp) - { - temp->mPrevpp = &mHead.mNextp; - temp->mNextp = NULL; - mHead.mNextp = temp; - } - else - { - // otherwise, walk to the end of the list - mCurrentp = mHead.mNextp; - while (mCurrentp->mNextp) - { - mCurrentp = mCurrentp->mNextp; - } - temp->mPrevpp = &mCurrentp->mNextp; - temp->mNextp = NULL; - mCurrentp->mNextp = temp; - } - - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - mCount++; - return TRUE; -} - - -// returns number of items in the list -template <class DATA_TYPE> -S32 LLLinkedList<DATA_TYPE>::getLength() const -{ -// S32 length = 0; -// for (LLLinkNode* temp = mHead.mNextp; temp != NULL; temp = temp->mNextp) -// { -// length++; -// } - return mCount; -} - - -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::isEmpty() -{ - return (mCount == 0); -} - - -// search the list starting at mHead.mNextp and remove the link with mDatap == data -// leave mCurrentp and mCurrentOperatingp on the next entry -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::removeData(DATA_TYPE *data) -{ - BOOL b_found = FALSE; - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::removeData", 0); - } - - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - - while (mCurrentOperatingp) - { - if (mCurrentOperatingp->mDatap == data) - { - b_found = TRUE; - - // remove the node - - // if there is a next one, fix it - if (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp; - } - *(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp; - - // remove the LLLinkNode - - // if we were on the one we want to delete, bump the cached copies - if (mCurrentOperatingp == tcurrop) - { - tcurrop = tcurr = mCurrentOperatingp->mNextp; - } - else if (mCurrentOperatingp == tcurr) - { - tcurrop = tcurr = mCurrentOperatingp->mNextp; - } - - mCurrentp = mCurrentOperatingp->mNextp; - - mCurrentOperatingp->removeData(); - delete mCurrentOperatingp; - mCurrentOperatingp = mCurrentp; - mCount--; - break; - } - mCurrentOperatingp = mCurrentOperatingp->mNextp; - } - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return b_found; -} - -// search the list starting at mHead.mNextp and delete the link with mDatap == data -// leave mCurrentp and mCurrentOperatingp on the next entry -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::deleteData(DATA_TYPE *data) -{ - BOOL b_found = FALSE; - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::removeData", 0); - } - - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - - while (mCurrentOperatingp) - { - if (mCurrentOperatingp->mDatap == data) - { - b_found = TRUE; - - // remove the node - // if there is a next one, fix it - if (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp; - } - *(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp; - - // delete the LLLinkNode - // if we were on the one we want to delete, bump the cached copies - if (mCurrentOperatingp == tcurrop) - { - tcurrop = tcurr = mCurrentOperatingp->mNextp; - } - - // and delete the associated data - llassert(mCurrentOperatingp); - mCurrentp = mCurrentOperatingp->mNextp; - mCurrentOperatingp->deleteData(); - delete mCurrentOperatingp; - mCurrentOperatingp = mCurrentp; - mCount--; - break; - } - mCurrentOperatingp = mCurrentOperatingp->mNextp; - } - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return b_found; -} - - // remove all nodes from the list and delete the associated data -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::deleteAllData() -{ - LLLinkNode *temp; - // reset mCurrentp - mCurrentp = mHead.mNextp; - - while (mCurrentp) - { - temp = mCurrentp->mNextp; - mCurrentp->deleteData(); - delete mCurrentp; - mCurrentp = temp; - } - - // reset mHead and mCurrentp - mHead.mNextp = NULL; - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - mCount = 0; -} - -// remove all nodes from the list but do not delete data -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::removeAllNodes() -{ - LLLinkNode *temp; - // reset mCurrentp - mCurrentp = mHead.mNextp; - - while (mCurrentp) - { - temp = mCurrentp->mNextp; - mCurrentp->removeData(); - delete mCurrentp; - mCurrentp = temp; - } - - // reset mHead and mCurrentp - mHead.mNextp = NULL; - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - mCount = 0; -} - -// check to see if data is in list -// if TRUE then mCurrentp and mCurrentOperatingp point to data -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::checkData(DATA_TYPE *data) -{ - // reset mCurrentp - mCurrentp = mHead.mNextp; - - while (mCurrentp) - { - if (mCurrentp->mDatap == data) - { - mCurrentOperatingp = mCurrentp; - return TRUE; - } - mCurrentp = mCurrentp->mNextp; - } - mCurrentOperatingp = mCurrentp; - return FALSE; -} - -// place mCurrentp on first node -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::resetList() -{ - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; -} - -// return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp -template <class DATA_TYPE> -DATA_TYPE *LLLinkedList<DATA_TYPE>::getCurrentData() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mNextp; - return mCurrentOperatingp->mDatap; - } - else - { - return NULL; - } -} - -// same as getCurrentData() but a more intuitive name for the operation -template <class DATA_TYPE> -DATA_TYPE *LLLinkedList<DATA_TYPE>::getNextData() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mNextp; - return mCurrentOperatingp->mDatap; - } - else - { - return NULL; - } -} - -// reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp -template <class DATA_TYPE> -DATA_TYPE *LLLinkedList<DATA_TYPE>::getFirstData() -{ - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mNextp; - return mCurrentOperatingp->mDatap; - } - else - { - return NULL; - } -} - -// Note: n is zero-based -template <class DATA_TYPE> -DATA_TYPE *LLLinkedList<DATA_TYPE>::getNthData( U32 n ) -{ - mCurrentOperatingp = mHead.mNextp; - - // if empty, return NULL - if (!mCurrentOperatingp) - { - return NULL; - } - - for( U32 i = 0; i < n; i++ ) - { - mCurrentOperatingp = mCurrentOperatingp->mNextp; - if( !mCurrentOperatingp ) - { - return NULL; - } - } - - mCurrentp = mCurrentOperatingp->mNextp; - return mCurrentOperatingp->mDatap; -} - - -// reset the list and return the last data in it, set mCurentOperatingp to that node and bump mCurrentp -template <class DATA_TYPE> -DATA_TYPE *LLLinkedList<DATA_TYPE>::getLastData() -{ - mCurrentOperatingp = mHead.mNextp; - - // if empty, return NULL - if (!mCurrentOperatingp) - return NULL; - - // walk until we're pointing at the last entry - while (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp = mCurrentOperatingp->mNextp; - } - mCurrentp = mCurrentOperatingp->mNextp; - return mCurrentOperatingp->mDatap; -} - -// remove the Node at mCurentOperatingp -// leave mCurrentp and mCurentOperatingp on the next entry -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::removeCurrentData() -{ - if (mCurrentOperatingp) - { - // remove the node - // if there is a next one, fix it - if (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp; - } - *(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp; - - // remove the LLLinkNode - mCurrentp = mCurrentOperatingp->mNextp; - - mCurrentOperatingp->removeData(); - delete mCurrentOperatingp; - mCount--; - mCurrentOperatingp = mCurrentp; - } -} - -// remove the Node at mCurentOperatingp and add it to newlist -// leave mCurrentp and mCurentOperatingp on the next entry -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::moveCurrentData(LLLinkedList *newlist, BOOL b_sort) -{ - if (mCurrentOperatingp) - { - // remove the node - // if there is a next one, fix it - if (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp; - } - *(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp; - - // remove the LLLinkNode - mCurrentp = mCurrentOperatingp->mNextp; - // move the node to the new list - newlist->addData(mCurrentOperatingp); - if (b_sort) - bubbleSortList(); - mCurrentOperatingp = mCurrentp; - } -} - -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::moveData(DATA_TYPE *data, LLLinkedList *newlist, BOOL b_sort) -{ - BOOL b_found = FALSE; - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::removeData", 0); - } - - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - - while (mCurrentOperatingp) - { - if (mCurrentOperatingp->mDatap == data) - { - b_found = TRUE; - - // remove the node - - // if there is a next one, fix it - if (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp; - } - *(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp; - - // if we were on the one we want to delete, bump the cached copies - if ( (mCurrentOperatingp == tcurrop) - ||(mCurrentOperatingp == tcurr)) - { - tcurrop = tcurr = mCurrentOperatingp->mNextp; - } - - // remove the LLLinkNode - mCurrentp = mCurrentOperatingp->mNextp; - // move the node to the new list - newlist->addData(mCurrentOperatingp); - if (b_sort) - newlist->bubbleSortList(); - mCurrentOperatingp = mCurrentp; - break; - } - mCurrentOperatingp = mCurrentOperatingp->mNextp; - } - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return b_found; -} - -// delete the Node at mCurentOperatingp -// leave mCurrentp anf mCurentOperatingp on the next entry -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::deleteCurrentData() -{ - if (mCurrentOperatingp) - { - // remove the node - // if there is a next one, fix it - if (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp; - } - *(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp; - - // remove the LLLinkNode - mCurrentp = mCurrentOperatingp->mNextp; - - mCurrentOperatingp->deleteData(); - if (mCurrentOperatingp->mDatap) - llerror("This is impossible!", 0); - delete mCurrentOperatingp; - mCurrentOperatingp = mCurrentp; - mCount--; - } -} - -#endif diff --git a/indra/llcommon/ll_template_cast.h b/indra/llcommon/ll_template_cast.h deleted file mode 100755 index c8f9a2f7eb..0000000000 --- a/indra/llcommon/ll_template_cast.h +++ /dev/null @@ -1,177 +0,0 @@ -/** - * @file ll_template_cast.h - * @author Nat Goodspeed - * @date 2009-11-21 - * @brief Define ll_template_cast function - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#if ! defined(LL_LL_TEMPLATE_CAST_H) -#define LL_LL_TEMPLATE_CAST_H - -/** - * Implementation for ll_template_cast() (q.v.). - * - * Default implementation: trying to cast two completely unrelated types - * returns 0. Typically you'd specify T and U as pointer types, but in fact T - * can be any type that can be initialized with 0. - */ -template <typename T, typename U> -struct ll_template_cast_impl -{ - T operator()(U) - { - return 0; - } -}; - -/** - * ll_template_cast<T>(some_value) is for use in a template function when - * some_value might be of arbitrary type, but you want to recognize type T - * specially. - * - * It's designed for use with pointer types. Example: - * @code - * struct SpecialClass - * { - * void someMethod(const std::string&) const; - * }; - * - * template <class REALCLASS> - * void somefunc(const REALCLASS& instance) - * { - * const SpecialClass* ptr = ll_template_cast<const SpecialClass*>(&instance); - * if (ptr) - * { - * ptr->someMethod("Call method only available on SpecialClass"); - * } - * } - * @endcode - * - * Why is this better than dynamic_cast<>? Because unless OtherClass is - * polymorphic, the following won't even compile (gcc 4.0.1): - * @code - * OtherClass other; - * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&other); - * @endcode - * to say nothing of this: - * @code - * void function(int); - * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&function); - * @endcode - * ll_template_cast handles these kinds of cases by returning 0. - */ -template <typename T, typename U> -T ll_template_cast(U value) -{ - return ll_template_cast_impl<T, U>()(value); -} - -/** - * Implementation for ll_template_cast() (q.v.). - * - * Implementation for identical types: return same value. - */ -template <typename T> -struct ll_template_cast_impl<T, T> -{ - T operator()(T value) - { - return value; - } -}; - -/** - * LL_TEMPLATE_CONVERTIBLE(dest, source) asserts that, for a value @c s of - * type @c source, <tt>ll_template_cast<dest>(s)</tt> will return @c s -- - * presuming that @c source can be converted to @c dest by the normal rules of - * C++. - * - * By default, <tt>ll_template_cast<dest>(s)</tt> will return 0 unless @c s's - * type is literally identical to @c dest. (This is because of the - * straightforward application of template specialization rules.) That can - * lead to surprising results, e.g.: - * - * @code - * Foo myFoo; - * const Foo* fooptr = ll_template_cast<const Foo*>(&myFoo); - * @endcode - * - * Here @c fooptr will be 0 because <tt>&myFoo</tt> is of type <tt>Foo*</tt> - * -- @em not <tt>const Foo*</tt>. (Declaring <tt>const Foo myFoo;</tt> would - * force the compiler to do the right thing.) - * - * More disappointingly: - * @code - * struct Base {}; - * struct Subclass: public Base {}; - * Subclass object; - * Base* ptr = ll_template_cast<Base*>(&object); - * @endcode - * - * Here @c ptr will be 0 because <tt>&object</tt> is of type - * <tt>Subclass*</tt> rather than <tt>Base*</tt>. We @em want this cast to - * succeed, but without our help ll_template_cast can't recognize it. - * - * The following would suffice: - * @code - * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*); - * ... - * Base* ptr = ll_template_cast<Base*>(&object); - * @endcode - * - * However, as noted earlier, this is easily fooled: - * @code - * const Base* ptr = ll_template_cast<const Base*>(&object); - * @endcode - * would still produce 0 because we haven't yet seen: - * @code - * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*); - * @endcode - * - * @TODO - * This macro should use Boost type_traits facilities for stripping and - * re-adding @c const and @c volatile qualifiers so that invoking - * LL_TEMPLATE_CONVERTIBLE(dest, source) will automatically generate all - * permitted permutations. It's really not fair to the coder to require - * separate: - * @code - * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*); - * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*); - * LL_TEMPLATE_CONVERTIBLE(const Base*, const Subclass*); - * @endcode - * - * (Naturally we omit <tt>LL_TEMPLATE_CONVERTIBLE(Base*, const Subclass*)</tt> - * because that's not permitted by normal C++ assignment anyway.) - */ -#define LL_TEMPLATE_CONVERTIBLE(DEST, SOURCE) \ -template <> \ -struct ll_template_cast_impl<DEST, SOURCE> \ -{ \ - DEST operator()(SOURCE wrapper) \ - { \ - return wrapper; \ - } \ -} - -#endif /* ! defined(LL_LL_TEMPLATE_CAST_H) */ diff --git a/indra/llcommon/llaccountingcost.h b/indra/llcommon/llaccountingcost.h deleted file mode 100755 index 0ef3b50c6d..0000000000 --- a/indra/llcommon/llaccountingcost.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @file llaccountingcost.h - * @ - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_ACCOUNTINGQUOTA_H -#define LL_ACCOUNTINGQUOTA_H - -struct ParcelQuota -{ - ParcelQuota( F32 ownerRenderCost, F32 ownerPhysicsCost, F32 ownerNetworkCost, F32 ownerSimulationCost, - F32 groupRenderCost, F32 groupPhysicsCost, F32 groupNetworkCost, F32 groupSimulationCost, - F32 otherRenderCost, F32 otherPhysicsCost, F32 otherNetworkCost, F32 otherSimulationCost, - F32 tempRenderCost, F32 tempPhysicsCost, F32 tempNetworkCost, F32 tempSimulationCost, - F32 selectedRenderCost, F32 selectedPhysicsCost, F32 selectedNetworkCost, F32 selectedSimulationCost, - F32 parcelCapacity ) - : mOwnerRenderCost( ownerRenderCost ), mOwnerPhysicsCost( ownerPhysicsCost ) - , mOwnerNetworkCost( ownerNetworkCost ), mOwnerSimulationCost( ownerSimulationCost ) - , mGroupRenderCost( groupRenderCost ), mGroupPhysicsCost( groupPhysicsCost ) - , mGroupNetworkCost( groupNetworkCost ), mGroupSimulationCost( groupSimulationCost ) - , mOtherRenderCost( otherRenderCost ), mOtherPhysicsCost( otherPhysicsCost ) - , mOtherNetworkCost( otherNetworkCost ), mOtherSimulationCost( otherSimulationCost ) - , mTempRenderCost( tempRenderCost ), mTempPhysicsCost( tempPhysicsCost ) - , mTempNetworkCost( tempNetworkCost ), mTempSimulationCost( tempSimulationCost ) - , mSelectedRenderCost( tempRenderCost ), mSelectedPhysicsCost( tempPhysicsCost ) - , mSelectedNetworkCost( tempNetworkCost ), mSelectedSimulationCost( selectedSimulationCost ) - , mParcelCapacity( parcelCapacity ) - { - } - - ParcelQuota(){} - F32 mOwnerRenderCost, mOwnerPhysicsCost, mOwnerNetworkCost, mOwnerSimulationCost; - F32 mGroupRenderCost, mGroupPhysicsCost, mGroupNetworkCost, mGroupSimulationCost; - F32 mOtherRenderCost, mOtherPhysicsCost, mOtherNetworkCost, mOtherSimulationCost; - F32 mTempRenderCost, mTempPhysicsCost, mTempNetworkCost, mTempSimulationCost; - F32 mSelectedRenderCost, mSelectedPhysicsCost, mSelectedNetworkCost, mSelectedSimulationCost; - F32 mParcelCapacity; -}; - -//SelectionQuota atm does not require a id -struct SelectionCost -{ - SelectionCost( /*LLTransactionID transactionId, */ F32 physicsCost, F32 networkCost, F32 simulationCost ) - //: mTransactionId( transactionId) - : mPhysicsCost( physicsCost ) - , mNetworkCost( networkCost ) - , mSimulationCost( simulationCost ) - { - } - SelectionCost() - : mPhysicsCost( 0.0f ) - , mNetworkCost( 0.0f ) - , mSimulationCost( 0.0f ) - {} - - F32 mPhysicsCost, mNetworkCost, mSimulationCost; - //LLTransactionID mTransactionId; -}; - -typedef enum { Roots = 0 , Prims } eSelectionType; - -#endif - - - diff --git a/indra/llcommon/llagentconstants.h b/indra/llcommon/llagentconstants.h deleted file mode 100755 index cd237da4eb..0000000000 --- a/indra/llcommon/llagentconstants.h +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @file llagentconstants.h - * @author James Cook, Andrew Meadows, Richard Nelson - * @brief Shared constants through the system for agents. - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLAGENTCONSTANTS_H -#define LL_LLAGENTCONSTANTS_H - -const U32 CONTROL_AT_POS_INDEX = 0; -const U32 CONTROL_AT_NEG_INDEX = 1; -const U32 CONTROL_LEFT_POS_INDEX = 2; -const U32 CONTROL_LEFT_NEG_INDEX = 3; -const U32 CONTROL_UP_POS_INDEX = 4; -const U32 CONTROL_UP_NEG_INDEX = 5; -const U32 CONTROL_PITCH_POS_INDEX = 6; -const U32 CONTROL_PITCH_NEG_INDEX = 7; -const U32 CONTROL_YAW_POS_INDEX = 8; -const U32 CONTROL_YAW_NEG_INDEX = 9; -const U32 CONTROL_FAST_AT_INDEX = 10; -const U32 CONTROL_FAST_LEFT_INDEX = 11; -const U32 CONTROL_FAST_UP_INDEX = 12; -const U32 CONTROL_FLY_INDEX = 13; -const U32 CONTROL_STOP_INDEX = 14; -const U32 CONTROL_FINISH_ANIM_INDEX = 15; -const U32 CONTROL_STAND_UP_INDEX = 16; -const U32 CONTROL_SIT_ON_GROUND_INDEX = 17; -const U32 CONTROL_MOUSELOOK_INDEX = 18; -const U32 CONTROL_NUDGE_AT_POS_INDEX = 19; -const U32 CONTROL_NUDGE_AT_NEG_INDEX = 20; -const U32 CONTROL_NUDGE_LEFT_POS_INDEX = 21; -const U32 CONTROL_NUDGE_LEFT_NEG_INDEX = 22; -const U32 CONTROL_NUDGE_UP_POS_INDEX = 23; -const U32 CONTROL_NUDGE_UP_NEG_INDEX = 24; -const U32 CONTROL_TURN_LEFT_INDEX = 25; -const U32 CONTROL_TURN_RIGHT_INDEX = 26; -const U32 CONTROL_AWAY_INDEX = 27; -const U32 CONTROL_LBUTTON_DOWN_INDEX = 28; -const U32 CONTROL_LBUTTON_UP_INDEX = 29; -const U32 CONTROL_ML_LBUTTON_DOWN_INDEX = 30; -const U32 CONTROL_ML_LBUTTON_UP_INDEX = 31; -const U32 TOTAL_CONTROLS = 32; - -const U32 AGENT_CONTROL_AT_POS = 0x1 << CONTROL_AT_POS_INDEX; // 0x00000001 -const U32 AGENT_CONTROL_AT_NEG = 0x1 << CONTROL_AT_NEG_INDEX; // 0x00000002 -const U32 AGENT_CONTROL_LEFT_POS = 0x1 << CONTROL_LEFT_POS_INDEX; // 0x00000004 -const U32 AGENT_CONTROL_LEFT_NEG = 0x1 << CONTROL_LEFT_NEG_INDEX; // 0x00000008 -const U32 AGENT_CONTROL_UP_POS = 0x1 << CONTROL_UP_POS_INDEX; // 0x00000010 -const U32 AGENT_CONTROL_UP_NEG = 0x1 << CONTROL_UP_NEG_INDEX; // 0x00000020 -const U32 AGENT_CONTROL_PITCH_POS = 0x1 << CONTROL_PITCH_POS_INDEX; // 0x00000040 -const U32 AGENT_CONTROL_PITCH_NEG = 0x1 << CONTROL_PITCH_NEG_INDEX; // 0x00000080 -const U32 AGENT_CONTROL_YAW_POS = 0x1 << CONTROL_YAW_POS_INDEX; // 0x00000100 -const U32 AGENT_CONTROL_YAW_NEG = 0x1 << CONTROL_YAW_NEG_INDEX; // 0x00000200 - -const U32 AGENT_CONTROL_FAST_AT = 0x1 << CONTROL_FAST_AT_INDEX; // 0x00000400 -const U32 AGENT_CONTROL_FAST_LEFT = 0x1 << CONTROL_FAST_LEFT_INDEX; // 0x00000800 -const U32 AGENT_CONTROL_FAST_UP = 0x1 << CONTROL_FAST_UP_INDEX; // 0x00001000 - -const U32 AGENT_CONTROL_FLY = 0x1 << CONTROL_FLY_INDEX; // 0x00002000 -const U32 AGENT_CONTROL_STOP = 0x1 << CONTROL_STOP_INDEX; // 0x00004000 -const U32 AGENT_CONTROL_FINISH_ANIM = 0x1 << CONTROL_FINISH_ANIM_INDEX; // 0x00008000 -const U32 AGENT_CONTROL_STAND_UP = 0x1 << CONTROL_STAND_UP_INDEX; // 0x00010000 -const U32 AGENT_CONTROL_SIT_ON_GROUND = 0x1 << CONTROL_SIT_ON_GROUND_INDEX; // 0x00020000 -const U32 AGENT_CONTROL_MOUSELOOK = 0x1 << CONTROL_MOUSELOOK_INDEX; // 0x00040000 - -const U32 AGENT_CONTROL_NUDGE_AT_POS = 0x1 << CONTROL_NUDGE_AT_POS_INDEX; // 0x00080000 -const U32 AGENT_CONTROL_NUDGE_AT_NEG = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX; // 0x00100000 -const U32 AGENT_CONTROL_NUDGE_LEFT_POS = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX; // 0x00200000 -const U32 AGENT_CONTROL_NUDGE_LEFT_NEG = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX; // 0x00400000 -const U32 AGENT_CONTROL_NUDGE_UP_POS = 0x1 << CONTROL_NUDGE_UP_POS_INDEX; // 0x00800000 -const U32 AGENT_CONTROL_NUDGE_UP_NEG = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX; // 0x01000000 -const U32 AGENT_CONTROL_TURN_LEFT = 0x1 << CONTROL_TURN_LEFT_INDEX; // 0x02000000 -const U32 AGENT_CONTROL_TURN_RIGHT = 0x1 << CONTROL_TURN_RIGHT_INDEX; // 0x04000000 - -const U32 AGENT_CONTROL_AWAY = 0x1 << CONTROL_AWAY_INDEX; // 0x08000000 - -const U32 AGENT_CONTROL_LBUTTON_DOWN = 0x1 << CONTROL_LBUTTON_DOWN_INDEX; // 0x10000000 -const U32 AGENT_CONTROL_LBUTTON_UP = 0x1 << CONTROL_LBUTTON_UP_INDEX; // 0x20000000 -const U32 AGENT_CONTROL_ML_LBUTTON_DOWN = 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX; // 0x40000000 -const U32 AGENT_CONTROL_ML_LBUTTON_UP = ((U32)0x1) << CONTROL_ML_LBUTTON_UP_INDEX; // 0x80000000 - -const U32 AGENT_CONTROL_AT = AGENT_CONTROL_AT_POS - | AGENT_CONTROL_AT_NEG - | AGENT_CONTROL_NUDGE_AT_POS - | AGENT_CONTROL_NUDGE_AT_NEG; - -const U32 AGENT_CONTROL_LEFT = AGENT_CONTROL_LEFT_POS - | AGENT_CONTROL_LEFT_NEG - | AGENT_CONTROL_NUDGE_LEFT_POS - | AGENT_CONTROL_NUDGE_LEFT_NEG; - -const U32 AGENT_CONTROL_UP = AGENT_CONTROL_UP_POS - | AGENT_CONTROL_UP_NEG - | AGENT_CONTROL_NUDGE_UP_POS - | AGENT_CONTROL_NUDGE_UP_NEG; - -const U32 AGENT_CONTROL_HORIZONTAL = AGENT_CONTROL_AT - | AGENT_CONTROL_LEFT; - -const U32 AGENT_CONTROL_NOT_USED_BY_LSL = AGENT_CONTROL_FLY - | AGENT_CONTROL_STOP - | AGENT_CONTROL_FINISH_ANIM - | AGENT_CONTROL_STAND_UP - | AGENT_CONTROL_SIT_ON_GROUND - | AGENT_CONTROL_MOUSELOOK - | AGENT_CONTROL_AWAY; - -const U32 AGENT_CONTROL_MOVEMENT = AGENT_CONTROL_AT - | AGENT_CONTROL_LEFT - | AGENT_CONTROL_UP; - -const U32 AGENT_CONTROL_ROTATION = AGENT_CONTROL_PITCH_POS - | AGENT_CONTROL_PITCH_NEG - | AGENT_CONTROL_YAW_POS - | AGENT_CONTROL_YAW_NEG; - -const U32 AGENT_CONTROL_NUDGE = AGENT_CONTROL_NUDGE_AT_POS - | AGENT_CONTROL_NUDGE_AT_NEG - | AGENT_CONTROL_NUDGE_LEFT_POS - | AGENT_CONTROL_NUDGE_LEFT_NEG; - - -// move these up so that we can hide them in "State" for object updates -// (for now) -const U32 AGENT_ATTACH_OFFSET = 4; -const U32 AGENT_ATTACH_MASK = 0xf << AGENT_ATTACH_OFFSET; -const U32 AGENT_ATTACH_CLEAR = 0x00; - -// RN: this method swaps the upper and lower nibbles to maintain backward -// compatibility with old objects that only used the upper nibble -#define ATTACHMENT_ID_FROM_STATE(state) ((S32)((((U8)state & AGENT_ATTACH_MASK) >> 4) | (((U8)state & ~AGENT_ATTACH_MASK) << 4))) - -// test state for use in testing grabbing the camera -const U32 AGENT_CAMERA_OBJECT = 0x1 << 3; - -const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters? - -#endif diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index afa06df23e..82df78a335 100755 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -30,7 +30,6 @@ #include <map> #include "llrun.h" #include "llsd.h" -#include "lloptioninterface.h" // Forward declarations template <typename Type> class LLAtomic32; @@ -64,7 +63,7 @@ namespace google_breakpad { class ExceptionHandler; // See exception_handler.h } -class LL_COMMON_API LLApp : public LLOptionInterface +class LL_COMMON_API LLApp { friend class LLErrorThread; public: @@ -113,7 +112,7 @@ public: * @param name The name of the option. * @return Returns the option data. */ - virtual LLSD getOption(const std::string& name) const; + LLSD getOption(const std::string& name) const; /** * @brief Parse command line options and insert them into diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index 69b01731e5..5a95a58d93 100755 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -29,8 +29,6 @@ #include <string> -#include "stdenums.h" // for EDragAndDropType - class LL_COMMON_API LLAssetType { public: diff --git a/indra/llcommon/llavatarconstants.h b/indra/llcommon/llavatarconstants.h deleted file mode 100755 index f47f447b45..0000000000 --- a/indra/llcommon/llavatarconstants.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @file llavatarconstants.h - * @brief some useful short term constants for Indra - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_AVATAR_CONSTANTS_H -#define LL_AVATAR_CONSTANTS_H - -// If this string is passed to dataserver in AvatarPropertiesUpdate -// then no change is made to user.profile_web -const char* const BLACKLIST_PROFILE_WEB_STR = "featureWebProfilesDisabled"; - -// If profile web pages are feature blacklisted then this URL is -// shown in the profile instead of the user's set URL -const char* const BLACKLIST_PROFILE_WEB_URL = "http://secondlife.com/app/webdisabled"; - -// Maximum number of avatar picks -const S32 MAX_AVATAR_PICKS = 10; - -// For Flags in AvatarPropertiesReply -const U32 AVATAR_ALLOW_PUBLISH = 0x1 << 0; // whether profile is externally visible or not -const U32 AVATAR_MATURE_PUBLISH = 0x1 << 1; // profile is "mature" -const U32 AVATAR_IDENTIFIED = 0x1 << 2; // whether avatar has provided payment info -const U32 AVATAR_TRANSACTED = 0x1 << 3; // whether avatar has actively used payment info -const U32 AVATAR_ONLINE = 0x1 << 4; // the online status of this avatar, if known. -const U32 AVATAR_AGEVERIFIED = 0x1 << 5; // whether avatar has been age-verified - -char const* const VISIBILITY_DEFAULT = "default"; -char const* const VISIBILITY_HIDDEN = "hidden"; -char const* const VISIBILITY_VISIBLE = "visible"; -char const* const VISIBILITY_INVISIBLE = "invisible"; - -#endif - diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp deleted file mode 100755 index 642bd82e90..0000000000 --- a/indra/llcommon/llavatarname.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/** - * @file llavatarname.cpp - * @brief Represents name-related data for an avatar, such as the - * username/SLID ("bobsmith123" or "james.linden") and the display - * name ("James Cook") - * - * $LicenseInfo:firstyear=2010&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#include "linden_common.h" - -#include "llavatarname.h" - -#include "lldate.h" -#include "llframetimer.h" -#include "llsd.h" - -// Store these in pre-built std::strings to avoid memory allocations in -// LLSD map lookups -static const std::string USERNAME("username"); -static const std::string DISPLAY_NAME("display_name"); -static const std::string LEGACY_FIRST_NAME("legacy_first_name"); -static const std::string LEGACY_LAST_NAME("legacy_last_name"); -static const std::string IS_DISPLAY_NAME_DEFAULT("is_display_name_default"); -static const std::string DISPLAY_NAME_EXPIRES("display_name_expires"); -static const std::string DISPLAY_NAME_NEXT_UPDATE("display_name_next_update"); - -bool LLAvatarName::sUseDisplayNames = true; - -// Minimum time-to-live (in seconds) for a name entry. -// Avatar name should always guarantee to expire reasonably soon by default -// so if the failure to get a valid expiration time was due to something temporary -// we will eventually request and get the right data. -const F64 MIN_ENTRY_LIFETIME = 60.0; - -LLAvatarName::LLAvatarName() -: mUsername(), - mDisplayName(), - mLegacyFirstName(), - mLegacyLastName(), - mIsDisplayNameDefault(false), - mIsTemporaryName(false), - mExpires(F64_MAX), - mNextUpdate(0.0) -{ } - -bool LLAvatarName::operator<(const LLAvatarName& rhs) const -{ - if (mUsername == rhs.mUsername) - return mDisplayName < rhs.mDisplayName; - else - return mUsername < rhs.mUsername; -} - -//static -void LLAvatarName::setUseDisplayNames(bool use) -{ - sUseDisplayNames = use; -} -//static -bool LLAvatarName::useDisplayNames() -{ - return sUseDisplayNames; -} - -LLSD LLAvatarName::asLLSD() const -{ - LLSD sd; - sd[USERNAME] = mUsername; - sd[DISPLAY_NAME] = mDisplayName; - sd[LEGACY_FIRST_NAME] = mLegacyFirstName; - sd[LEGACY_LAST_NAME] = mLegacyLastName; - sd[IS_DISPLAY_NAME_DEFAULT] = mIsDisplayNameDefault; - sd[DISPLAY_NAME_EXPIRES] = LLDate(mExpires); - sd[DISPLAY_NAME_NEXT_UPDATE] = LLDate(mNextUpdate); - return sd; -} - -void LLAvatarName::fromLLSD(const LLSD& sd) -{ - mUsername = sd[USERNAME].asString(); - mDisplayName = sd[DISPLAY_NAME].asString(); - mLegacyFirstName = sd[LEGACY_FIRST_NAME].asString(); - mLegacyLastName = sd[LEGACY_LAST_NAME].asString(); - mIsDisplayNameDefault = sd[IS_DISPLAY_NAME_DEFAULT].asBoolean(); - LLDate expires = sd[DISPLAY_NAME_EXPIRES]; - mExpires = expires.secondsSinceEpoch(); - LLDate next_update = sd[DISPLAY_NAME_NEXT_UPDATE]; - mNextUpdate = next_update.secondsSinceEpoch(); - - // Some avatars don't have explicit display names set. Force a legible display name here. - if (mDisplayName.empty()) - { - mDisplayName = mUsername; - } -} - -// Transform a string (typically provided by the legacy service) into a decent -// avatar name instance. -void LLAvatarName::fromString(const std::string& full_name) -{ - mDisplayName = full_name; - std::string::size_type index = full_name.find(' '); - if (index != std::string::npos) - { - // The name is in 2 parts (first last) - mLegacyFirstName = full_name.substr(0, index); - mLegacyLastName = full_name.substr(index+1); - if (mLegacyLastName != "Resident") - { - mUsername = mLegacyFirstName + "." + mLegacyLastName; - mDisplayName = full_name; - LLStringUtil::toLower(mUsername); - } - else - { - // Very old names do have a dummy "Resident" last name - // that we choose to hide from users. - mUsername = mLegacyFirstName; - mDisplayName = mLegacyFirstName; - } - } - else - { - mLegacyFirstName = full_name; - mLegacyLastName = ""; - mUsername = full_name; - mDisplayName = full_name; - } - mIsDisplayNameDefault = true; - mIsTemporaryName = true; - setExpires(MIN_ENTRY_LIFETIME); -} - -void LLAvatarName::setExpires(F64 expires) -{ - mExpires = LLFrameTimer::getTotalSeconds() + expires; -} - -std::string LLAvatarName::getCompleteName() const -{ - std::string name; - if (sUseDisplayNames) - { - if (mUsername.empty() || mIsDisplayNameDefault) - { - // If this particular display name is defaulted (i.e. based on user name), - // then display only the easier to read instance of the person's name. - name = mDisplayName; - } - else - { - name = mDisplayName + " (" + mUsername + ")"; - } - } - else - { - name = getUserName(); - } - return name; -} - -std::string LLAvatarName::getLegacyName() const -{ - if (mLegacyFirstName.empty() && mLegacyLastName.empty()) // display names disabled? - { - return mDisplayName; - } - - std::string name; - name.reserve( mLegacyFirstName.size() + 1 + mLegacyLastName.size() ); - name = mLegacyFirstName; - name += " "; - name += mLegacyLastName; - return name; -} - -std::string LLAvatarName::getDisplayName() const -{ - if (sUseDisplayNames) - { - return mDisplayName; - } - else - { - return getUserName(); - } -} - -std::string LLAvatarName::getUserName() const -{ - std::string name; - if (mLegacyLastName.empty() || (mLegacyLastName == "Resident")) - { - if (mLegacyFirstName.empty()) - { - // If we cannot create a user name from the legacy strings, use the display name - name = mDisplayName; - } - else - { - // The last name might be empty if it defaulted to "Resident" - name = mLegacyFirstName; - } - } - else - { - name = mLegacyFirstName + " " + mLegacyLastName; - } - return name; -} - -void LLAvatarName::dump() const -{ - LL_DEBUGS("AvNameCache") << "LLAvatarName: " - << "user '" << mUsername << "' " - << "display '" << mDisplayName << "' " - << "expires in " << mExpires - LLFrameTimer::getTotalSeconds() << " seconds" - << LL_ENDL; -} - diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h deleted file mode 100755 index 5d2fccc5ba..0000000000 --- a/indra/llcommon/llavatarname.h +++ /dev/null @@ -1,133 +0,0 @@ -/** - * @file llavatarname.h - * @brief Represents name-related data for an avatar, such as the - * username/SLID ("bobsmith123" or "james.linden") and the display - * name ("James Cook") - * - * $LicenseInfo:firstyear=2010&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#ifndef LLAVATARNAME_H -#define LLAVATARNAME_H - -#include <string> - -class LLSD; - -class LL_COMMON_API LLAvatarName -{ -public: - LLAvatarName(); - - bool operator<(const LLAvatarName& rhs) const; - - // Conversion to and from LLSD (cache file or server response) - LLSD asLLSD() const; - void fromLLSD(const LLSD& sd); - - // Used only in legacy mode when the display name capability is not provided server side - // or to otherwise create a temporary valid item. - void fromString(const std::string& full_name); - - // Set the name object to become invalid in "expires" seconds from now - void setExpires(F64 expires); - - // Set and get the display name flag set by the user in preferences. - static void setUseDisplayNames(bool use); - static bool useDisplayNames(); - - // A name object is valid if not temporary and not yet expired (default is expiration not checked) - bool isValidName(F64 max_unrefreshed = 0.0f) const { return !mIsTemporaryName && (mExpires >= max_unrefreshed); } - - // Return true if the name is made up from legacy or temporary data - bool isDisplayNameDefault() const { return mIsDisplayNameDefault; } - - // For normal names, returns "James Linden (james.linden)" - // When display names are disabled returns just "James Linden" - std::string getCompleteName() const; - - // Returns "James Linden" or "bobsmith123 Resident" for backwards - // compatibility with systems like voice and muting - // *TODO: Eliminate this in favor of username only - std::string getLegacyName() const; - - // "José Sanchez" or "James Linden", UTF-8 encoded Unicode - // Takes the display name preference into account. This is truly the name that should - // be used for all UI where an avatar name has to be used unless we truly want something else (rare) - std::string getDisplayName() const; - - // Returns "James Linden" or "bobsmith123 Resident" - // Used where we explicitely prefer or need a non UTF-8 legacy (ASCII) name - // Also used for backwards compatibility with systems like voice and muting - std::string getUserName() const; - - // Returns "james.linden" or the legacy name for very old names - std::string getAccountName() const { return mUsername; } - - // Debug print of the object - void dump() const; - - // Names can change, so need to keep track of when name was - // last checked. - // Unix time-from-epoch seconds for efficiency - F64 mExpires; - - // You can only change your name every N hours, so record - // when the next update is allowed - // Unix time-from-epoch seconds - F64 mNextUpdate; - -private: - // "bobsmith123" or "james.linden", US-ASCII only - std::string mUsername; - - // "José Sanchez" or "James Linden", UTF-8 encoded Unicode - // Contains data whether or not user has explicitly set - // a display name; may duplicate their username. - std::string mDisplayName; - - // For "James Linden", "James" - // For "bobsmith123", "bobsmith123" - // Used to communicate with legacy systems like voice and muting which - // rely on old-style names. - // *TODO: Eliminate this in favor of username only - std::string mLegacyFirstName; - - // For "James Linden", "Linden" - // For "bobsmith123", "Resident" - // see above for rationale - std::string mLegacyLastName; - - // If true, both display name and SLID were generated from - // a legacy first and last name, like "James Linden (james.linden)" - bool mIsDisplayNameDefault; - - // Under error conditions, we may insert "dummy" records with - // names like "???" into caches as placeholders. These can be - // shown in UI, but are not serialized. - bool mIsTemporaryName; - - // Global flag indicating if display name should be used or not - // This will affect the output of the high level "get" methods - static bool sUseDisplayNames; -}; - -#endif diff --git a/indra/llcommon/bitpack.cpp b/indra/llcommon/llbitpack.cpp index cdcaba0765..622a099945 100755 --- a/indra/llcommon/bitpack.cpp +++ b/indra/llcommon/llbitpack.cpp @@ -27,4 +27,4 @@ #include "linden_common.h" // implementation is all in the header, this include dep ensures the unit test is rerun if the implementation changes. -#include "bitpack.h" +#include "llbitpack.h" diff --git a/indra/llcommon/bitpack.h b/indra/llcommon/llbitpack.h index 037300dd14..fea56a4f1f 100755 --- a/indra/llcommon/bitpack.h +++ b/indra/llcommon/llbitpack.h @@ -1,5 +1,5 @@ /** - * @file bitpack.h + * @file llbitpack.h * @brief Convert data to packed bit stream * * $LicenseInfo:firstyear=2000&license=viewerlgpl$ @@ -79,7 +79,7 @@ public: *(mBuffer + mBufferSize++) = mLoad; if (mBufferSize > mMaxSize) { - llerror("mBufferSize exceeding mMaxSize!", 0); + LL_ERRS() << "mBufferSize exceeding mMaxSize!" << LL_ENDL; } mLoadSize = 0; mLoad = 0x00; @@ -122,7 +122,7 @@ public: *(mBuffer + mBufferSize++) = mLoad; if (mBufferSize > mMaxSize) { - llerror("mBufferSize exceeding mMaxSize!", 0); + LL_ERRS() << "mBufferSize exceeding mMaxSize!" << LL_ENDL; } mLoadSize = 0; mLoad = 0x00; @@ -190,7 +190,7 @@ public: *(mBuffer + mBufferSize++) = mLoad; if (mBufferSize > mMaxSize) { - llerror("mBufferSize exceeding mMaxSize!", 0); + LL_ERRS() << "mBufferSize exceeding mMaxSize!" << LL_ENDL; } mLoadSize = 0; } diff --git a/indra/llcommon/llchat.h b/indra/llcommon/llchat.h deleted file mode 100755 index f5b242fdfc..0000000000 --- a/indra/llcommon/llchat.h +++ /dev/null @@ -1,109 +0,0 @@ -/** - * @file llchat.h - * @author James Cook - * @brief Chat constants and data structures. - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLCHAT_H -#define LL_LLCHAT_H - -#include "lluuid.h" -#include "v3math.h" - -// enumerations used by the chat system -typedef enum e_chat_source_type -{ - CHAT_SOURCE_SYSTEM = 0, - CHAT_SOURCE_AGENT = 1, - CHAT_SOURCE_OBJECT = 2, - CHAT_SOURCE_UNKNOWN = 3 -} EChatSourceType; - -typedef enum e_chat_type -{ - CHAT_TYPE_WHISPER = 0, - CHAT_TYPE_NORMAL = 1, - CHAT_TYPE_SHOUT = 2, - CHAT_TYPE_START = 4, - CHAT_TYPE_STOP = 5, - CHAT_TYPE_DEBUG_MSG = 6, - CHAT_TYPE_REGION = 7, - CHAT_TYPE_OWNER = 8, - CHAT_TYPE_DIRECT = 9 // From llRegionSayTo() -} EChatType; - -typedef enum e_chat_audible_level -{ - CHAT_AUDIBLE_NOT = -1, - CHAT_AUDIBLE_BARELY = 0, - CHAT_AUDIBLE_FULLY = 1 -} EChatAudible; - -typedef enum e_chat_style -{ - CHAT_STYLE_NORMAL, - CHAT_STYLE_IRC, - CHAT_STYLE_HISTORY -}EChatStyle; - -// A piece of chat -class LLChat -{ -public: - LLChat(const std::string& text = std::string()) - : mText(text), - mFromName(), - mFromID(), - mNotifId(), - mOwnerID(), - mSourceType(CHAT_SOURCE_AGENT), - mChatType(CHAT_TYPE_NORMAL), - mAudible(CHAT_AUDIBLE_FULLY), - mMuted(FALSE), - mTime(0.0), - mTimeStr(), - mPosAgent(), - mURL(), - mChatStyle(CHAT_STYLE_NORMAL), - mSessionID() - { } - - std::string mText; // UTF-8 line of text - std::string mFromName; // agent or object name - LLUUID mFromID; // agent id or object id - LLUUID mNotifId; - LLUUID mOwnerID; - EChatSourceType mSourceType; - EChatType mChatType; - EChatAudible mAudible; - BOOL mMuted; // pass muted chat to maintain list of chatters - F64 mTime; // viewer only, seconds from viewer start - std::string mTimeStr; - LLVector3 mPosAgent; - std::string mURL; - EChatStyle mChatStyle; - LLUUID mSessionID; -}; - -#endif diff --git a/indra/llcommon/llclickaction.h b/indra/llcommon/llclickaction.h deleted file mode 100755 index 1f87d8eec3..0000000000 --- a/indra/llcommon/llclickaction.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file llclickaction.h - * @author James Cook - * @brief Constants for single-click actions on objects - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLCLICKACTION_H -#define LL_LLCLICKACTION_H -// DO NOT CHANGE THE SEQUENCE OF THIS LIST!! -const U8 CLICK_ACTION_NONE = 0; -const U8 CLICK_ACTION_TOUCH = 0; -const U8 CLICK_ACTION_SIT = 1; -const U8 CLICK_ACTION_BUY = 2; -const U8 CLICK_ACTION_PAY = 3; -const U8 CLICK_ACTION_OPEN = 4; -const U8 CLICK_ACTION_PLAY = 5; -const U8 CLICK_ACTION_OPEN_MEDIA = 6; -const U8 CLICK_ACTION_ZOOM = 7; -// DO NOT CHANGE THE SEQUENCE OF THIS LIST!! -#endif diff --git a/indra/llcommon/llcursortypes.cpp b/indra/llcommon/llcursortypes.cpp deleted file mode 100755 index ec60097195..0000000000 --- a/indra/llcommon/llcursortypes.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/** - * @file llcursortypes.cpp - * @brief Cursor types and lookup of types from a string - * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llcursortypes.h" - -ECursorType getCursorFromString(const std::string& cursor_string) -{ - static std::map<std::string,U32> cursor_string_table; - if (cursor_string_table.empty()) - { - cursor_string_table["UI_CURSOR_ARROW"] = UI_CURSOR_ARROW; - cursor_string_table["UI_CURSOR_WAIT"] = UI_CURSOR_WAIT; - cursor_string_table["UI_CURSOR_HAND"] = UI_CURSOR_HAND; - cursor_string_table["UI_CURSOR_IBEAM"] = UI_CURSOR_IBEAM; - cursor_string_table["UI_CURSOR_CROSS"] = UI_CURSOR_CROSS; - cursor_string_table["UI_CURSOR_SIZENWSE"] = UI_CURSOR_SIZENWSE; - cursor_string_table["UI_CURSOR_SIZENESW"] = UI_CURSOR_SIZENESW; - cursor_string_table["UI_CURSOR_SIZEWE"] = UI_CURSOR_SIZEWE; - cursor_string_table["UI_CURSOR_SIZENS"] = UI_CURSOR_SIZENS; - cursor_string_table["UI_CURSOR_NO"] = UI_CURSOR_NO; - cursor_string_table["UI_CURSOR_WORKING"] = UI_CURSOR_WORKING; - cursor_string_table["UI_CURSOR_TOOLGRAB"] = UI_CURSOR_TOOLGRAB; - cursor_string_table["UI_CURSOR_TOOLLAND"] = UI_CURSOR_TOOLLAND; - cursor_string_table["UI_CURSOR_TOOLFOCUS"] = UI_CURSOR_TOOLFOCUS; - cursor_string_table["UI_CURSOR_TOOLCREATE"] = UI_CURSOR_TOOLCREATE; - cursor_string_table["UI_CURSOR_ARROWDRAG"] = UI_CURSOR_ARROWDRAG; - cursor_string_table["UI_CURSOR_ARROWCOPY"] = UI_CURSOR_ARROWCOPY; - cursor_string_table["UI_CURSOR_ARROWDRAGMULTI"] = UI_CURSOR_ARROWDRAGMULTI; - cursor_string_table["UI_CURSOR_ARROWCOPYMULTI"] = UI_CURSOR_ARROWCOPYMULTI; - cursor_string_table["UI_CURSOR_NOLOCKED"] = UI_CURSOR_NOLOCKED; - cursor_string_table["UI_CURSOR_ARROWLOCKED"] = UI_CURSOR_ARROWLOCKED; - cursor_string_table["UI_CURSOR_GRABLOCKED"] = UI_CURSOR_GRABLOCKED; - cursor_string_table["UI_CURSOR_TOOLTRANSLATE"] = UI_CURSOR_TOOLTRANSLATE; - cursor_string_table["UI_CURSOR_TOOLROTATE"] = UI_CURSOR_TOOLROTATE; - cursor_string_table["UI_CURSOR_TOOLSCALE"] = UI_CURSOR_TOOLSCALE; - cursor_string_table["UI_CURSOR_TOOLCAMERA"] = UI_CURSOR_TOOLCAMERA; - cursor_string_table["UI_CURSOR_TOOLPAN"] = UI_CURSOR_TOOLPAN; - cursor_string_table["UI_CURSOR_TOOLZOOMIN"] = UI_CURSOR_TOOLZOOMIN; - cursor_string_table["UI_CURSOR_TOOLPICKOBJECT3"] = UI_CURSOR_TOOLPICKOBJECT3; - cursor_string_table["UI_CURSOR_TOOLPLAY"] = UI_CURSOR_TOOLPLAY; - cursor_string_table["UI_CURSOR_TOOLPAUSE"] = UI_CURSOR_TOOLPAUSE; - cursor_string_table["UI_CURSOR_TOOLMEDIAOPEN"] = UI_CURSOR_TOOLMEDIAOPEN; - cursor_string_table["UI_CURSOR_PIPETTE"] = UI_CURSOR_PIPETTE; - cursor_string_table["UI_CURSOR_TOOLSIT"] = UI_CURSOR_TOOLSIT; - cursor_string_table["UI_CURSOR_TOOLBUY"] = UI_CURSOR_TOOLBUY; - cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN; - cursor_string_table["UI_CURSOR_TOOLPATHFINDING"] = UI_CURSOR_TOOLPATHFINDING; - cursor_string_table["UI_CURSOR_TOOLPATHFINDINGPATHSTART"] = UI_CURSOR_TOOLPATHFINDING_PATH_START; - cursor_string_table["UI_CURSOR_TOOLPATHFINDINGPATHSTARTADD"] = UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD; - cursor_string_table["UI_CURSOR_TOOLPATHFINDINGPATHEND"] = UI_CURSOR_TOOLPATHFINDING_PATH_END; - cursor_string_table["UI_CURSOR_TOOLPATHFINDINGPATHENDADD"] = UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD; - cursor_string_table["UI_CURSOR_TOOLNO"] = UI_CURSOR_TOOLNO; - } - - std::map<std::string,U32>::const_iterator iter = cursor_string_table.find(cursor_string); - - if (iter != cursor_string_table.end()) - { - return (ECursorType)iter->second; - } - - return UI_CURSOR_ARROW; -} - - - diff --git a/indra/llcommon/llcursortypes.h b/indra/llcommon/llcursortypes.h deleted file mode 100755 index cb6d6636a0..0000000000 --- a/indra/llcommon/llcursortypes.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @file llcursortypes.h - * @brief Cursor types - * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLCURSORTYPES_H -#define LL_LLCURSORTYPES_H - -// If you add types here, add them in LLCursor::getCursorFromString -enum ECursorType { - UI_CURSOR_ARROW, - UI_CURSOR_WAIT, - UI_CURSOR_HAND, - UI_CURSOR_IBEAM, - UI_CURSOR_CROSS, - UI_CURSOR_SIZENWSE, - UI_CURSOR_SIZENESW, - UI_CURSOR_SIZEWE, - UI_CURSOR_SIZENS, - UI_CURSOR_NO, - UI_CURSOR_WORKING, - UI_CURSOR_TOOLGRAB, - UI_CURSOR_TOOLLAND, - UI_CURSOR_TOOLFOCUS, - UI_CURSOR_TOOLCREATE, - UI_CURSOR_ARROWDRAG, - UI_CURSOR_ARROWCOPY, // drag with copy - UI_CURSOR_ARROWDRAGMULTI, - UI_CURSOR_ARROWCOPYMULTI, // drag with copy - UI_CURSOR_NOLOCKED, - UI_CURSOR_ARROWLOCKED, - UI_CURSOR_GRABLOCKED, - UI_CURSOR_TOOLTRANSLATE, - UI_CURSOR_TOOLROTATE, - UI_CURSOR_TOOLSCALE, - UI_CURSOR_TOOLCAMERA, - UI_CURSOR_TOOLPAN, - UI_CURSOR_TOOLZOOMIN, - UI_CURSOR_TOOLPICKOBJECT3, - UI_CURSOR_TOOLPLAY, - UI_CURSOR_TOOLPAUSE, - UI_CURSOR_TOOLMEDIAOPEN, - UI_CURSOR_PIPETTE, - UI_CURSOR_TOOLSIT, - UI_CURSOR_TOOLBUY, - UI_CURSOR_TOOLOPEN, - UI_CURSOR_TOOLPATHFINDING, - UI_CURSOR_TOOLPATHFINDING_PATH_START, - UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD, - UI_CURSOR_TOOLPATHFINDING_PATH_END, - UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD, - UI_CURSOR_TOOLNO, - UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor) -}; - -LL_COMMON_API ECursorType getCursorFromString(const std::string& cursor_string); - -#endif // LL_LLCURSORTYPES_H diff --git a/indra/llcommon/lldarray.h b/indra/llcommon/lldarray.h deleted file mode 100755 index 131b819c99..0000000000 --- a/indra/llcommon/lldarray.h +++ /dev/null @@ -1,223 +0,0 @@ -/** - * @file lldarray.h - * @brief Wrapped std::vector for backward compatibility. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLDARRAY_H -#define LL_LLDARRAY_H - -#include "llerror.h" - -#include <vector> -#include <map> - -// class LLDynamicArray<>; // = std::vector + reserves <BlockSize> elements -// class LLDynamicArrayIndexed<>; // = std::vector + std::map if indices, only supports operator[] and begin(),end() - -//-------------------------------------------------------- -// LLDynamicArray declaration -//-------------------------------------------------------- -// NOTE: BlockSize is used to reserve a minimal initial amount -template <typename Type, int BlockSize = 32> -class LLDynamicArray : public std::vector<Type> -{ -public: - enum - { - OKAY = 0, - FAIL = -1 - }; - - LLDynamicArray(S32 size=0) : std::vector<Type>(size) { if (size < BlockSize) std::vector<Type>::reserve(BlockSize); } - - void reset() { std::vector<Type>::clear(); } - - // ACCESSORS - const Type& get(S32 index) const { return std::vector<Type>::operator[](index); } - Type& get(S32 index) { return std::vector<Type>::operator[](index); } - S32 find(const Type &obj) const; - - S32 count() const { return std::vector<Type>::size(); } - S32 getLength() const { return std::vector<Type>::size(); } - S32 getMax() const { return std::vector<Type>::capacity(); } - - // MANIPULATE - S32 put(const Type &obj); // add to end of array, returns index -// Type* reserve(S32 num); // reserve a block of indices in advance - Type* reserve_block(U32 num); // reserve a block of indices in advance - - S32 remove(S32 index); // remove by index, no bounds checking - S32 removeObj(const Type &obj); // remove by object - S32 removeLast(); - - void operator+=(const LLDynamicArray<Type,BlockSize> &other); -}; - -//-------------------------------------------------------- -// LLDynamicArray implementation -//-------------------------------------------------------- - -template <typename Type,int BlockSize> -inline S32 LLDynamicArray<Type,BlockSize>::find(const Type &obj) const -{ - typename std::vector<Type>::const_iterator iter = std::find(this->begin(), this->end(), obj); - if (iter != this->end()) - { - return iter - this->begin(); - } - return FAIL; -} - - -template <typename Type,int BlockSize> -inline S32 LLDynamicArray<Type,BlockSize>::remove(S32 i) -{ - // This is a fast removal by swapping with the last element - S32 sz = this->size(); - if (i < 0 || i >= sz) - { - return FAIL; - } - if (i < sz-1) - { - this->operator[](i) = this->back(); - } - this->pop_back(); - return i; -} - -template <typename Type,int BlockSize> -inline S32 LLDynamicArray<Type,BlockSize>::removeObj(const Type& obj) -{ - typename std::vector<Type>::iterator iter = std::find(this->begin(), this->end(), obj); - if (iter != this->end()) - { - S32 res = iter - this->begin(); - typename std::vector<Type>::iterator last = this->end(); - --last; - *iter = *last; - this->pop_back(); - return res; - } - return FAIL; -} - -template <typename Type,int BlockSize> -inline S32 LLDynamicArray<Type,BlockSize>::removeLast() -{ - if (!this->empty()) - { - this->pop_back(); - return OKAY; - } - return FAIL; -} - -template <typename Type,int BlockSize> -inline Type* LLDynamicArray<Type,BlockSize>::reserve_block(U32 num) -{ - U32 sz = this->size(); - this->resize(sz+num); - return &(this->operator[](sz)); -} - -template <typename Type,int BlockSize> -inline S32 LLDynamicArray<Type,BlockSize>::put(const Type &obj) -{ - this->push_back(obj); - return this->size() - 1; -} - -template <typename Type,int BlockSize> -inline void LLDynamicArray<Type,BlockSize>::operator+=(const LLDynamicArray<Type,BlockSize> &other) -{ - insert(this->end(), other.begin(), other.end()); -} - -//-------------------------------------------------------- -// LLDynamicArrayIndexed declaration -//-------------------------------------------------------- - -template <typename Type, typename Key, int BlockSize = 32> -class LLDynamicArrayIndexed -{ -public: - typedef typename std::vector<Type>::iterator iterator; - typedef typename std::vector<Type>::const_iterator const_iterator; - typedef typename std::vector<Type>::reverse_iterator reverse_iterator; - typedef typename std::vector<Type>::const_reverse_iterator const_reverse_iterator; - typedef typename std::vector<Type>::size_type size_type; -protected: - std::vector<Type> mVector; - std::map<Key, U32> mIndexMap; - -public: - LLDynamicArrayIndexed() { mVector.reserve(BlockSize); } - - iterator begin() { return mVector.begin(); } - const_iterator begin() const { return mVector.begin(); } - iterator end() { return mVector.end(); } - const_iterator end() const { return mVector.end(); } - - reverse_iterator rbegin() { return mVector.rbegin(); } - const_reverse_iterator rbegin() const { return mVector.rbegin(); } - reverse_iterator rend() { return mVector.rend(); } - const_reverse_iterator rend() const { return mVector.rend(); } - - void reset() { mVector.resize(0); mIndexMap.resize(0); } - bool empty() const { return mVector.empty(); } - size_type size() const { return mVector.size(); } - - Type& operator[](const Key& k) - { - typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); - if (iter == mIndexMap.end()) - { - U32 n = mVector.size(); - mIndexMap[k] = n; - mVector.push_back(Type()); - llassert(mVector.size() == mIndexMap.size()); - return mVector[n]; - } - else - { - return mVector[iter->second]; - } - } - - const_iterator find(const Key& k) const - { - typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); - if(iter == mIndexMap.end()) - { - return mVector.end(); - } - else - { - return mVector.begin() + iter->second; - } - } -}; - -#endif diff --git a/indra/llcommon/lldeleteutils.h b/indra/llcommon/lldeleteutils.h deleted file mode 100644 index f250dc3028..0000000000 --- a/indra/llcommon/lldeleteutils.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @file lldeleteutils.h - * @brief Utility functions to simplify some common pointer-munging idioms. - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#ifndef LL_DELETE_UTILS_H -#define LL_DELETE_UTILS_H - -// Simple utility functions to eventually replace the common 2-line -// idiom scattered throughout the viewer codebase. Note that where -// possible we would rather be using smart pointers of some sort. - -template <class T> -inline void deleteAndClear(T*& ptr) -{ - delete ptr; - ptr = NULL; -} - -template <class T> -inline void deleteAndClearArray(T*& array_ptr) -{ - delete[] array_ptr; - array_ptr = NULL; -} - -#endif diff --git a/indra/llcommon/lldepthstack.h b/indra/llcommon/lldepthstack.h index ac435a30fa..b65840d342 100755 --- a/indra/llcommon/lldepthstack.h +++ b/indra/llcommon/lldepthstack.h @@ -41,8 +41,6 @@ public: : mCurrentDepth(0), mMaxDepth(0) {} - ~LLDepthStack() {} - void setDepth(U32 depth) { mMaxDepth = depth; @@ -87,14 +85,7 @@ public: { return mStack.empty() ? NULL : mStack.back(); } - - void deleteAllData() - { - mCurrentDepth = 0; - std::for_each(mStack.begin(), mStack.end(), DeletePointer()); - mStack.clear(); - } - + void removeAllNodes() { mCurrentDepth = 0; diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 5b4be1ac80..6da9df4dce 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -96,7 +96,7 @@ namespace { mFile.open(filename, llofstream::out | llofstream::app); if (!mFile) { - llinfos << "Error setting log file to " << filename << llendl; + LL_INFOS() << "Error setting log file to " << filename << LL_ENDL; } } @@ -331,7 +331,7 @@ namespace } LLError::configure(configuration); - llinfos << "logging reconfigured from " << filename() << llendl; + LL_INFOS() << "logging reconfigured from " << filename() << LL_ENDL; return true; } @@ -495,14 +495,44 @@ namespace LLError int line, const std::type_info& class_info, const char* function, + bool printOnce, const char* broadTag, - const char* narrowTag, - bool printOnce) - : mLevel(level), mFile(file), mLine(line), - mClassInfo(class_info), mFunction(function), - mCached(false), mShouldLog(false), - mBroadTag(broadTag), mNarrowTag(narrowTag), mPrintOnce(printOnce) - { } + const char* narrowTag) + : mLevel(level), + mFile(file), + mLine(line), + mClassInfo(class_info), + mFunction(function), + mCached(false), + mShouldLog(false), + mPrintOnce(printOnce), + mBroadTag(broadTag), + mNarrowTag(narrowTag) + {} + + CallSite::CallSite(ELevel level, + const char* file, + int line, + const std::type_info& class_info, + const char* function, + bool printOnce, + const char* broadTag, + const char* narrowTag, + const char*, + ...) + : mLevel(level), + mFile(file), + mLine(line), + mClassInfo(class_info), + mFunction(function), + mCached(false), + mShouldLog(false), + mPrintOnce(printOnce), + mBroadTag(broadTag), + mNarrowTag(narrowTag) + { + LL_ERRS() << "No support for more than 2 logging tags" << LL_ENDL; + } void CallSite::invalidate() @@ -677,7 +707,7 @@ namespace LLError LevelMap::const_iterator i = level_names.find(name); if (i == level_names.end()) { - llwarns << "unrecognized logging level: '" << name << "'" << llendl; + LL_WARNS() << "unrecognized logging level: '" << name << "'" << LL_ENDL; return LLError::LEVEL_INFO; } @@ -741,6 +771,12 @@ namespace LLError return false; } + // virtual + bool Recorder::wantsTags() + { + return false; + } + void addRecorder(Recorder* recorder) { if (recorder == NULL) @@ -817,11 +853,14 @@ namespace LLError namespace { - void writeToRecorders(LLError::ELevel level, const std::string& message) + void writeToRecorders(const LLError::CallSite& site, const std::string& message) { + LLError::ELevel level = site.mLevel; LLError::Settings& s = LLError::Settings::get(); std::string messageWithTime; + std::string messageWithTags; + std::string messageWithTagsAndTime; for (Recorders::const_iterator i = s.recorders.begin(); i != s.recorders.end(); @@ -829,18 +868,47 @@ namespace { LLError::Recorder* r = *i; - if (r->wantsTime() && s.timeFunction != NULL) + if (r->wantsTime() && s.timeFunction != NULL) { - if (messageWithTime.empty()) + if (r->wantsTags()) { - messageWithTime = s.timeFunction() + " " + message; + if (messageWithTagsAndTime.empty()) + { + messageWithTagsAndTime = s.timeFunction() + " " + + (site.mBroadTag ? (std::string("#") + std::string(site.mBroadTag) + " ") : std::string()) + + (site.mNarrowTag ? (std::string("#") + std::string(site.mNarrowTag) + " ") : std::string()) + + message; + } + + r->recordMessage(level, messageWithTagsAndTime); + } + else + { + if (messageWithTime.empty()) + { + messageWithTime = s.timeFunction() + " " + message; + } + + r->recordMessage(level, messageWithTime); } - - r->recordMessage(level, messageWithTime); } else { - r->recordMessage(level, message); + if (r->wantsTags()) + { + if (messageWithTags.empty()) + { + messageWithTags = (site.mBroadTag ? (std::string("#") + std::string(site.mBroadTag) + " ") : std::string()) + + (site.mNarrowTag ? (std::string("#") + std::string(site.mNarrowTag) + " ") : std::string()) + + message; + } + + r->recordMessage(level, messageWithTags); + } + else + { + r->recordMessage(level, message); + } } } } @@ -1017,10 +1085,11 @@ namespace LLError else { strncpy(message, out->str().c_str(), 127); - message[127] = '\0' ; + message[127] = '\0'; } Globals& g = Globals::get(); + if (out == &g.messageStream) { g.messageStream.clear(); @@ -1031,7 +1100,7 @@ namespace LLError { delete out; } - return ; + return; } void Log::flush(std::ostringstream* out, const CallSite& site) @@ -1063,7 +1132,7 @@ namespace LLError fatalMessage << abbreviateFile(site.mFile) << "(" << site.mLine << ") : error"; - writeToRecorders(site.mLevel, fatalMessage.str()); + writeToRecorders(site, fatalMessage.str()); } @@ -1125,7 +1194,7 @@ namespace LLError prefix << message; message = prefix.str(); - writeToRecorders(site.mLevel, message); + writeToRecorders(site, message); if (site.mLevel == LEVEL_ERROR && s.crashFunction) { @@ -1164,7 +1233,7 @@ namespace LLError { std::string::size_type i = 0; std::string::size_type len = s.length(); - for ( ; i < len; i++ ) + for (; i < len; i++ ) { if (s[i] == old) { @@ -1235,8 +1304,8 @@ namespace LLError namespace LLError { - char** LLCallStacks::sBuffer = NULL ; - S32 LLCallStacks::sIndex = 0 ; + char** LLCallStacks::sBuffer = NULL; + S32 LLCallStacks::sIndex = 0; #define SINGLE_THREADED 1 @@ -1312,34 +1381,34 @@ namespace LLError if(!sBuffer) { - sBuffer = new char*[512] ; - sBuffer[0] = new char[512 * 128] ; - for(S32 i = 1 ; i < 512 ; i++) + sBuffer = new char*[512]; + sBuffer[0] = new char[512 * 128]; + for(S32 i = 1; i < 512; i++) { - sBuffer[i] = sBuffer[i-1] + 128 ; + sBuffer[i] = sBuffer[i-1] + 128; } - sIndex = 0 ; + sIndex = 0; } if(sIndex > 511) { - clear() ; + clear(); } - strcpy(sBuffer[sIndex], function) ; - sprintf(sBuffer[sIndex] + strlen(function), " line: %d ", line) ; - sIndex++ ; + strcpy(sBuffer[sIndex], function); + sprintf(sBuffer[sIndex] + strlen(function), " line: %d ", line); + sIndex++; - return ; + return; } //static std::ostringstream* LLCallStacks::insert(const char* function, const int line) { std::ostringstream* _out = LLError::Log::out(); - *_out << function << " line " << line << " " ; + *_out << function << " line " << line << " "; - return _out ; + return _out; } //static @@ -1353,21 +1422,21 @@ namespace LLError if(!sBuffer) { - sBuffer = new char*[512] ; - sBuffer[0] = new char[512 * 128] ; - for(S32 i = 1 ; i < 512 ; i++) + sBuffer = new char*[512]; + sBuffer[0] = new char[512 * 128]; + for(S32 i = 1; i < 512; i++) { - sBuffer[i] = sBuffer[i-1] + 128 ; + sBuffer[i] = sBuffer[i-1] + 128; } - sIndex = 0 ; + sIndex = 0; } if(sIndex > 511) { - clear() ; + clear(); } - LLError::Log::flush(_out, sBuffer[sIndex++]) ; + LLError::Log::flush(_out, sBuffer[sIndex++]); } //static @@ -1381,27 +1450,27 @@ namespace LLError if(sIndex > 0) { - llinfos << " ************* PRINT OUT LL CALL STACKS ************* " << llendl ; + LL_INFOS() << " ************* PRINT OUT LL CALL STACKS ************* " << LL_ENDL; while(sIndex > 0) { - sIndex-- ; - llinfos << sBuffer[sIndex] << llendl ; + sIndex--; + LL_INFOS() << sBuffer[sIndex] << LL_ENDL; } - llinfos << " *************** END OF LL CALL STACKS *************** " << llendl ; + LL_INFOS() << " *************** END OF LL CALL STACKS *************** " << LL_ENDL; } if(sBuffer) { - delete[] sBuffer[0] ; - delete[] sBuffer ; - sBuffer = NULL ; + delete[] sBuffer[0]; + delete[] sBuffer; + sBuffer = NULL; } } //static void LLCallStacks::clear() { - sIndex = 0 ; + sIndex = 0; } #if LL_WINDOWS diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index ceff40e900..d7dc38a4c6 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -31,9 +31,66 @@ #include <sstream> #include <typeinfo> -#include "llerrorlegacy.h" #include "stdtypes.h" +#include "llpreprocessor.h" +#include <boost/static_assert.hpp> + +const int LL_ERR_NOERR = 0; + +// Define one of these for different error levels in release... +// #define RELEASE_SHOW_DEBUG // Define this if you want your release builds to show lldebug output. +#define RELEASE_SHOW_INFO // Define this if you want your release builds to show llinfo output +#define RELEASE_SHOW_WARN // Define this if you want your release builds to show llwarn output. + +#ifdef _DEBUG +#define SHOW_DEBUG +#define SHOW_WARN +#define SHOW_INFO +#define SHOW_ASSERT +#else // _DEBUG + +#ifdef LL_RELEASE_WITH_DEBUG_INFO +#define SHOW_ASSERT +#endif // LL_RELEASE_WITH_DEBUG_INFO + +#ifdef RELEASE_SHOW_DEBUG +#define SHOW_DEBUG +#endif + +#ifdef RELEASE_SHOW_WARN +#define SHOW_WARN +#endif + +#ifdef RELEASE_SHOW_INFO +#define SHOW_INFO +#endif + +#ifdef RELEASE_SHOW_ASSERT +#define SHOW_ASSERT +#endif + +#endif // !_DEBUG + +#define llassert_always(func) if (LL_UNLIKELY(!(func))) LL_ERRS() << "ASSERT (" << #func << ")" << LL_ENDL; + +#ifdef SHOW_ASSERT +#define llassert(func) llassert_always(func) +#define llverify(func) llassert_always(func) +#else +#define llassert(func) +#define llverify(func) do {if (func) {}} while(0) +#endif + +#ifdef LL_WINDOWS +#define LL_STATIC_ASSERT(func, msg) static_assert(func, msg) +#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) static_assert(false, msg) +#else +#define LL_STATIC_ASSERT(func, msg) BOOST_STATIC_ASSERT(func) +#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) BOOST_STATIC_ASSERT(sizeof(type) != 0 && false); +#endif + + /** Error Logging Facility Information for most users: @@ -121,26 +178,25 @@ namespace LLError They are not intended for general use. */ - class CallSite; + struct CallSite; class LL_COMMON_API Log { public: static bool shouldLog(CallSite&); static std::ostringstream* out(); - static void flush(std::ostringstream* out, char* message) ; + static void flush(std::ostringstream* out, char* message); static void flush(std::ostringstream*, const CallSite&); }; - class LL_COMMON_API CallSite + struct LL_COMMON_API CallSite { // Represents a specific place in the code where a message is logged // This is public because it is used by the macros below. It is not // intended for public use. - public: CallSite(ELevel, const char* file, int line, - const std::type_info& class_info, const char* function, const char* broadTag, const char* narrowTag, bool printOnce); - + const std::type_info& class_info, const char* function, bool printOnce, const char* broadTag = NULL, const char* narrowTag = NULL ); + #ifdef LL_LIBRARY_INCLUDE bool shouldLog(); #else // LL_LIBRARY_INCLUDE @@ -151,7 +207,6 @@ namespace LLError void invalidate(); - private: // these describe the call site and never change const ELevel mLevel; const char* const mFile; @@ -167,6 +222,11 @@ namespace LLError bool mShouldLog; friend class Log; + + private: + // 3 or more tags not currently supported + CallSite(ELevel, const char* file, int line, + const std::type_info& class_info, const char* function, bool printOnce, const char* broadTag, const char* narrowTag, const char*, ...); }; @@ -237,78 +297,64 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG; // Outside a class declaration, or in class without LOG_CLASS(), this // typedef causes the messages to not be associated with any class. +///////////////////////////////// +// Error Logging Macros +// See top of file for common usage. +///////////////////////////////// +#define lllog(level, once, ...) \ + do { \ + static LLError::CallSite _site( \ + level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), __FUNCTION__, once, __VA_ARGS__ );\ + if (LL_UNLIKELY(_site.shouldLog())) \ + { \ + std::ostringstream* _out = LLError::Log::out(); \ + (*_out) +//Use this construct if you need to do computation in the middle of a +//message: +// +// LL_INFOS("AgentGesture") << "the agent " << agend_id; +// switch (f) +// { +// case FOP_SHRUGS: LL_CONT << "shrugs"; break; +// case FOP_TAPS: LL_CONT << "points at " << who; break; +// case FOP_SAYS: LL_CONT << "says " << message; break; +// } +// LL_CONT << " for " << t << " seconds" << LL_ENDL; +// +//Such computation is done iff the message will be logged. +#define LL_CONT (*_out) +#define LL_NEWLINE '\n' -/* - Error Logging Macros - See top of file for common usage. -*/ - -#define lllog(level, broadTag, narrowTag, once) \ - do { \ - static LLError::CallSite _site( \ - level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), __FUNCTION__, broadTag, narrowTag, once);\ - if (LL_UNLIKELY(_site.shouldLog())) \ - { \ - std::ostringstream* _out = LLError::Log::out(); \ - (*_out) - -// DEPRECATED: Don't call directly, use LL_ENDL instead, which actually looks like a macro -#define llendl \ - LLError::End(); \ +#define LL_ENDL \ + LLError::End(); \ LLError::Log::flush(_out, _site); \ - } \ + } \ } while(0) -// DEPRECATED: Use the new macros that allow tags and *look* like macros. -#define lldebugs lllog(LLError::LEVEL_DEBUG, NULL, NULL, false) -#define llinfos lllog(LLError::LEVEL_INFO, NULL, NULL, false) -#define llwarns lllog(LLError::LEVEL_WARN, NULL, NULL, false) -#define llerrs lllog(LLError::LEVEL_ERROR, NULL, NULL, false) -#define llcont (*_out) - // NEW Macros for debugging, allow the passing of a string tag -// One Tag -#define LL_DEBUGS(broadTag) lllog(LLError::LEVEL_DEBUG, broadTag, NULL, false) -#define LL_INFOS(broadTag) lllog(LLError::LEVEL_INFO, broadTag, NULL, false) -#define LL_WARNS(broadTag) lllog(LLError::LEVEL_WARN, broadTag, NULL, false) -#define LL_ERRS(broadTag) lllog(LLError::LEVEL_ERROR, broadTag, NULL, false) -// Two Tags -#define LL_DEBUGS2(broadTag, narrowTag) lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, false) -#define LL_INFOS2(broadTag, narrowTag) lllog(LLError::LEVEL_INFO, broadTag, narrowTag, false) -#define LL_WARNS2(broadTag, narrowTag) lllog(LLError::LEVEL_WARN, broadTag, narrowTag, false) -#define LL_ERRS2(broadTag, narrowTag) lllog(LLError::LEVEL_ERROR, broadTag, narrowTag, false) +// Pass comma separated list of tags (currently only supports up to 0, 1, or 2) +#define LL_DEBUGS(...) lllog(LLError::LEVEL_DEBUG, false, __VA_ARGS__) +#define LL_INFOS(...) lllog(LLError::LEVEL_INFO, false, __VA_ARGS__) +#define LL_WARNS(...) lllog(LLError::LEVEL_WARN, false, __VA_ARGS__) +#define LL_ERRS(...) lllog(LLError::LEVEL_ERROR, false, __VA_ARGS__) // Only print the log message once (good for warnings or infos that would otherwise // spam the log file over and over, such as tighter loops). -#define LL_DEBUGS_ONCE(broadTag) lllog(LLError::LEVEL_DEBUG, broadTag, NULL, true) -#define LL_INFOS_ONCE(broadTag) lllog(LLError::LEVEL_INFO, broadTag, NULL, true) -#define LL_WARNS_ONCE(broadTag) lllog(LLError::LEVEL_WARN, broadTag, NULL, true) -#define LL_DEBUGS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, true) -#define LL_INFOS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_INFO, broadTag, narrowTag, true) -#define LL_WARNS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_WARN, broadTag, narrowTag, true) - -#define LL_ENDL llendl -#define LL_CONT (*_out) +#define LL_DEBUGS_ONCE(...) lllog(LLError::LEVEL_DEBUG, true, __VA_ARGS__) +#define LL_INFOS_ONCE(...) lllog(LLError::LEVEL_INFO, true, __VA_ARGS__) +#define LL_WARNS_ONCE(...) lllog(LLError::LEVEL_WARN, true, __VA_ARGS__) - /* - Use this construct if you need to do computation in the middle of a - message: - - LL_INFOS("AgentGesture") << "the agent " << agend_id; - switch (f) - { - case FOP_SHRUGS: LL_CONT << "shrugs"; break; - case FOP_TAPS: LL_CONT << "points at " << who; break; - case FOP_SAYS: LL_CONT << "says " << message; break; - } - LL_CONT << " for " << t << " seconds" << LL_ENDL; - - Such computation is done iff the message will be logged. - */ +// DEPRECATED: Use the new macros that allow tags and *look* like macros. +#define lldebugs LL_DEBUGS() +#define llinfos LL_INFOS() +#define llwarns LL_WARNS() +#define llerrs LL_ERRS() +#define llcont LL_CONT +#define llendl LL_ENDL #endif // LL_LLERROR_H diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index 480654b1a2..7c9df57115 100755 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h @@ -144,6 +144,10 @@ namespace LLError virtual bool wantsTime(); // default returns false // override and return true if the recorder wants the time string // included in the text of the message + + virtual bool wantsTags(); // default returns false + // override ands return true if the recorder wants the tags included + // in the text of the message }; /** diff --git a/indra/llcommon/llerrorlegacy.h b/indra/llcommon/llerrorlegacy.h index 50c95339e4..31dd207008 100755 --- a/indra/llcommon/llerrorlegacy.h +++ b/indra/llcommon/llerrorlegacy.h @@ -28,100 +28,5 @@ #ifndef LL_LLERRORLEGACY_H #define LL_LLERRORLEGACY_H -#include "llpreprocessor.h" -#include <boost/static_assert.hpp> - -/* - LEGACY -- DO NOT USE THIS STUFF ANYMORE -*/ - -// Specific error codes -const int LL_ERR_NOERR = 0; -const int LL_ERR_ASSET_REQUEST_FAILED = -1; -//const int LL_ERR_ASSET_REQUEST_INVALID = -2; -const int LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE = -3; -const int LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE = -4; -const int LL_ERR_INSUFFICIENT_PERMISSIONS = -5; -const int LL_ERR_EOF = -39; -const int LL_ERR_CANNOT_OPEN_FILE = -42; -const int LL_ERR_FILE_NOT_FOUND = -43; -const int LL_ERR_FILE_EMPTY = -44; -const int LL_ERR_TCP_TIMEOUT = -23016; -const int LL_ERR_CIRCUIT_GONE = -23017; -const int LL_ERR_PRICE_MISMATCH = -23018; - - - -// Define one of these for different error levels in release... -// #define RELEASE_SHOW_DEBUG // Define this if you want your release builds to show lldebug output. -#define RELEASE_SHOW_INFO // Define this if you want your release builds to show llinfo output -#define RELEASE_SHOW_WARN // Define this if you want your release builds to show llwarn output. - - -////////////////////////////////////////// -// -// Implementation - ignore -// -// -#ifdef _DEBUG -#define SHOW_DEBUG -#define SHOW_WARN -#define SHOW_INFO -#define SHOW_ASSERT -#else // _DEBUG - -#ifdef LL_RELEASE_WITH_DEBUG_INFO -#define SHOW_ASSERT -#endif // LL_RELEASE_WITH_DEBUG_INFO - -#ifdef RELEASE_SHOW_DEBUG -#define SHOW_DEBUG -#endif - -#ifdef RELEASE_SHOW_WARN -#define SHOW_WARN -#endif - -#ifdef RELEASE_SHOW_INFO -#define SHOW_INFO -#endif - -#ifdef RELEASE_SHOW_ASSERT -#define SHOW_ASSERT -#endif - -#endif // _DEBUG - - - -#define lldebugst(type) lldebugs -#define llendflush llendl - - -#define llerror(msg, num) llerrs << "Error # " << num << ": " << msg << llendl; - -#define llwarning(msg, num) llwarns << "Warning # " << num << ": " << msg << llendl; - -#define llassert_always(func) if (LL_UNLIKELY(!(func))) llerrs << "ASSERT (" << #func << ")" << llendl; - -#ifdef SHOW_ASSERT -#define llassert(func) llassert_always(func) -#define llverify(func) llassert_always(func) -#else -#define llassert(func) -#define llverify(func) do {if (func) {}} while(0) -#endif - -#ifdef LL_WINDOWS -#define LL_STATIC_ASSERT(func, msg) static_assert(func, msg) -#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) static_assert(false, msg) -#else -#define LL_STATIC_ASSERT(func, msg) BOOST_STATIC_ASSERT(func) -#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) BOOST_STATIC_ASSERT(sizeof(type) != 0 && false); -#endif - -// handy compile-time assert - enforce those template parameters! -#define cassert(expn) typedef char __C_ASSERT__[(expn)?1:-1] /* Flawfinder: ignore */ - //XXX: used in two places in llcommon/llskipmap.h #endif // LL_LLERRORLEGACY_H diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index 65b0fef354..0cbd1da32d 100755 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -61,7 +61,7 @@ #include "llsd.h" #include "llsingleton.h" #include "lldependencies.h" -#include "ll_template_cast.h" +#include "llstl.h" /*==========================================================================*| // override this to allow binding free functions with more parameters diff --git a/indra/llcommon/llextendedstatus.h b/indra/llcommon/llextendedstatus.h deleted file mode 100755 index 8ce173d1ff..0000000000 --- a/indra/llcommon/llextendedstatus.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @file llextendedstatus.h - * @date August 2007 - * @brief extended status codes for curl/vfs/resident asset storage and delivery - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLEXTENDEDSTATUS_H -#define LL_LLEXTENDEDSTATUS_H - - -typedef S32 LLExtStat; - - -// Status provider groups - Top bits indicate which status type it is -// Zero is common status code (next section) -const LLExtStat LL_EXSTAT_CURL_RESULT = 1L<<30; // serviced by curl - use 1L if we really implement the below -const LLExtStat LL_EXSTAT_RES_RESULT = 2L<<30; // serviced by resident copy -const LLExtStat LL_EXSTAT_VFS_RESULT = 3L<<30; // serviced by vfs - - -// Common Status Codes -// -const LLExtStat LL_EXSTAT_NONE = 0x00000; // No extra info here - sorry! -const LLExtStat LL_EXSTAT_NULL_UUID = 0x10001; // null asset ID -const LLExtStat LL_EXSTAT_NO_UPSTREAM = 0x10002; // attempt to upload without a valid upstream method/provider -const LLExtStat LL_EXSTAT_REQUEST_DROPPED = 0x10003; // request was dropped unserviced -const LLExtStat LL_EXSTAT_NONEXISTENT_FILE = 0x10004; // trying to upload a file that doesn't exist -const LLExtStat LL_EXSTAT_BLOCKED_FILE = 0x10005; // trying to upload a file that we can't open - - -// curl status codes: -// -// Mask off LL_EXSTAT_CURL_RESULT for original result and -// see: libraries/include/curl/curl.h - - -// Memory-Resident status codes: -// None at present - - -// VFS status codes: -const LLExtStat LL_EXSTAT_VFS_CACHED = LL_EXSTAT_VFS_RESULT | 0x0001; -const LLExtStat LL_EXSTAT_VFS_CORRUPT = LL_EXSTAT_VFS_RESULT | 0x0002; - - -#endif // LL_LLEXTENDEDSTATUS_H diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llcommon/llfoldertype.cpp deleted file mode 100755 index f6d0f5bce8..0000000000 --- a/indra/llcommon/llfoldertype.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/** - * @file llfoldertype.cpp - * @brief Implementatino of LLFolderType functionality. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llfoldertype.h" -#include "lldictionary.h" -#include "llmemory.h" -#include "llsingleton.h" - -///---------------------------------------------------------------------------- -/// Class LLFolderType -///---------------------------------------------------------------------------- -struct FolderEntry : public LLDictionaryEntry -{ - FolderEntry(const std::string &type_name, // 8 character limit! - bool is_protected) // can the viewer change categories of this type? - : - LLDictionaryEntry(type_name), - mIsProtected(is_protected) - { - llassert(type_name.length() <= 8); - } - - const bool mIsProtected; -}; - -class LLFolderDictionary : public LLSingleton<LLFolderDictionary>, - public LLDictionary<LLFolderType::EType, FolderEntry> -{ -public: - LLFolderDictionary(); -protected: - virtual LLFolderType::EType notFound() const - { - return LLFolderType::FT_NONE; - } -}; - -LLFolderDictionary::LLFolderDictionary() -{ - // TYPE NAME PROTECTED - // |-----------|---------| - addEntry(LLFolderType::FT_TEXTURE, new FolderEntry("texture", TRUE)); - addEntry(LLFolderType::FT_SOUND, new FolderEntry("sound", TRUE)); - addEntry(LLFolderType::FT_CALLINGCARD, new FolderEntry("callcard", TRUE)); - addEntry(LLFolderType::FT_LANDMARK, new FolderEntry("landmark", TRUE)); - addEntry(LLFolderType::FT_CLOTHING, new FolderEntry("clothing", TRUE)); - addEntry(LLFolderType::FT_OBJECT, new FolderEntry("object", TRUE)); - addEntry(LLFolderType::FT_NOTECARD, new FolderEntry("notecard", TRUE)); - addEntry(LLFolderType::FT_ROOT_INVENTORY, new FolderEntry("root_inv", TRUE)); - addEntry(LLFolderType::FT_LSL_TEXT, new FolderEntry("lsltext", TRUE)); - addEntry(LLFolderType::FT_BODYPART, new FolderEntry("bodypart", TRUE)); - addEntry(LLFolderType::FT_TRASH, new FolderEntry("trash", TRUE)); - addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, new FolderEntry("snapshot", TRUE)); - addEntry(LLFolderType::FT_LOST_AND_FOUND, new FolderEntry("lstndfnd", TRUE)); - addEntry(LLFolderType::FT_ANIMATION, new FolderEntry("animatn", TRUE)); - addEntry(LLFolderType::FT_GESTURE, new FolderEntry("gesture", TRUE)); - addEntry(LLFolderType::FT_FAVORITE, new FolderEntry("favorite", TRUE)); - - for (S32 ensemble_num = S32(LLFolderType::FT_ENSEMBLE_START); ensemble_num <= S32(LLFolderType::FT_ENSEMBLE_END); ensemble_num++) - { - addEntry(LLFolderType::EType(ensemble_num), new FolderEntry("ensemble", FALSE)); - } - - addEntry(LLFolderType::FT_CURRENT_OUTFIT, new FolderEntry("current", TRUE)); - addEntry(LLFolderType::FT_OUTFIT, new FolderEntry("outfit", FALSE)); - addEntry(LLFolderType::FT_MY_OUTFITS, new FolderEntry("my_otfts", TRUE)); - - addEntry(LLFolderType::FT_MESH, new FolderEntry("mesh", TRUE)); - - addEntry(LLFolderType::FT_INBOX, new FolderEntry("inbox", TRUE)); - addEntry(LLFolderType::FT_OUTBOX, new FolderEntry("outbox", TRUE)); - addEntry(LLFolderType::FT_BASIC_ROOT, new FolderEntry("basic_rt", TRUE)); - - addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE)); -}; - -// static -LLFolderType::EType LLFolderType::lookup(const std::string& name) -{ - return LLFolderDictionary::getInstance()->lookup(name); -} - -// static -const std::string &LLFolderType::lookup(LLFolderType::EType folder_type) -{ - const FolderEntry *entry = LLFolderDictionary::getInstance()->lookup(folder_type); - if (entry) - { - return entry->mName; - } - else - { - return badLookup(); - } -} - -// static -// Only ensembles and plain folders aren't protected. "Protected" means -// you can't change certain properties such as their type. -bool LLFolderType::lookupIsProtectedType(EType folder_type) -{ - const LLFolderDictionary *dict = LLFolderDictionary::getInstance(); - const FolderEntry *entry = dict->lookup(folder_type); - if (entry) - { - return entry->mIsProtected; - } - return true; -} - -// static -bool LLFolderType::lookupIsEnsembleType(EType folder_type) -{ - return (folder_type >= FT_ENSEMBLE_START && - folder_type <= FT_ENSEMBLE_END); -} - -// static -LLAssetType::EType LLFolderType::folderTypeToAssetType(LLFolderType::EType folder_type) -{ - if (LLAssetType::lookup(LLAssetType::EType(folder_type)) == LLAssetType::badLookup()) - { - llwarns << "Converting to unknown asset type " << folder_type << llendl; - } - return (LLAssetType::EType)folder_type; -} - -// static -LLFolderType::EType LLFolderType::assetTypeToFolderType(LLAssetType::EType asset_type) -{ - if (LLFolderType::lookup(LLFolderType::EType(asset_type)) == LLFolderType::badLookup()) - { - llwarns << "Converting to unknown folder type " << asset_type << llendl; - } - return (LLFolderType::EType)asset_type; -} - -// static -const std::string &LLFolderType::badLookup() -{ - static const std::string sBadLookup = "llfoldertype_bad_lookup"; - return sBadLookup; -} diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h deleted file mode 100755 index a0c847914f..0000000000 --- a/indra/llcommon/llfoldertype.h +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @file llfoldertype.h - * @brief Declaration of LLFolderType. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLFOLDERTYPE_H -#define LL_LLFOLDERTYPE_H - -#include <string> -#include "llassettype.h" - -// This class handles folder types (similar to assettype, except for folders) -// and operations on those. -class LL_COMMON_API LLFolderType -{ -public: - // ! BACKWARDS COMPATIBILITY ! Folder type enums must match asset type enums. - enum EType - { - FT_TEXTURE = 0, - - FT_SOUND = 1, - - FT_CALLINGCARD = 2, - - FT_LANDMARK = 3, - - FT_CLOTHING = 5, - - FT_OBJECT = 6, - - FT_NOTECARD = 7, - - FT_ROOT_INVENTORY = 8, - // We'd really like to change this to 9 since AT_CATEGORY is 8, - // but "My Inventory" has been type 8 for a long time. - - FT_LSL_TEXT = 10, - - FT_BODYPART = 13, - - FT_TRASH = 14, - - FT_SNAPSHOT_CATEGORY = 15, - - FT_LOST_AND_FOUND = 16, - - FT_ANIMATION = 20, - - FT_GESTURE = 21, - - FT_FAVORITE = 23, - - FT_ENSEMBLE_START = 26, - FT_ENSEMBLE_END = 45, - // This range is reserved for special clothing folder types. - - FT_CURRENT_OUTFIT = 46, - FT_OUTFIT = 47, - FT_MY_OUTFITS = 48, - - FT_MESH = 49, - - FT_INBOX = 50, - FT_OUTBOX = 51, - - FT_BASIC_ROOT = 52, - - FT_COUNT, - - FT_NONE = -1 - }; - - static EType lookup(const std::string& type_name); - static const std::string& lookup(EType folder_type); - - static bool lookupIsProtectedType(EType folder_type); - static bool lookupIsEnsembleType(EType folder_type); - - static LLAssetType::EType folderTypeToAssetType(LLFolderType::EType folder_type); - static LLFolderType::EType assetTypeToFolderType(LLAssetType::EType asset_type); - - static const std::string& badLookup(); // error string when a lookup fails - -protected: - LLFolderType() {} - ~LLFolderType() {} -}; - -#endif // LL_LLFOLDERTYPE_H diff --git a/indra/llcommon/llframetimer.h b/indra/llcommon/llframetimer.h index 45754f3785..7f61861072 100755 --- a/indra/llcommon/llframetimer.h +++ b/indra/llcommon/llframetimer.h @@ -35,7 +35,6 @@ */ #include "lltimer.h" -#include "timing.h" class LL_COMMON_API LLFrameTimer { diff --git a/indra/llcommon/llindexedvector.h b/indra/llcommon/llindexedvector.h new file mode 100755 index 0000000000..68c3821802 --- /dev/null +++ b/indra/llcommon/llindexedvector.h @@ -0,0 +1,100 @@ +/** + * @file lldarray.h + * @brief Wrapped std::vector for backward compatibility. + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLDARRAY_H +#define LL_LLDARRAY_H + +#include "llerror.h" + +#include <vector> +#include <map> + +//-------------------------------------------------------- +// LLIndexedVector +//-------------------------------------------------------- + +template <typename Type, typename Key, int BlockSize = 32> +class LLIndexedVector +{ +public: + typedef typename std::vector<Type>::iterator iterator; + typedef typename std::vector<Type>::const_iterator const_iterator; + typedef typename std::vector<Type>::reverse_iterator reverse_iterator; + typedef typename std::vector<Type>::const_reverse_iterator const_reverse_iterator; + typedef typename std::vector<Type>::size_type size_type; +protected: + std::vector<Type> mVector; + std::map<Key, U32> mIndexMap; + +public: + LLIndexedVector() { mVector.reserve(BlockSize); } + + iterator begin() { return mVector.begin(); } + const_iterator begin() const { return mVector.begin(); } + iterator end() { return mVector.end(); } + const_iterator end() const { return mVector.end(); } + + reverse_iterator rbegin() { return mVector.rbegin(); } + const_reverse_iterator rbegin() const { return mVector.rbegin(); } + reverse_iterator rend() { return mVector.rend(); } + const_reverse_iterator rend() const { return mVector.rend(); } + + void reset() { mVector.resize(0); mIndexMap.resize(0); } + bool empty() const { return mVector.empty(); } + size_type size() const { return mVector.size(); } + + Type& operator[](const Key& k) + { + typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); + if (iter == mIndexMap.end()) + { + U32 n = mVector.size(); + mIndexMap[k] = n; + mVector.push_back(Type()); + llassert(mVector.size() == mIndexMap.size()); + return mVector[n]; + } + else + { + return mVector[iter->second]; + } + } + + const_iterator find(const Key& k) const + { + typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); + if(iter == mIndexMap.end()) + { + return mVector.end(); + } + else + { + return mVector.begin() + iter->second; + } + } +}; + +#endif diff --git a/indra/llcommon/llinitparam.cpp b/indra/llcommon/llinitparam.cpp index dbd4eba7a0..aa2f4eb289 100755 --- a/indra/llcommon/llinitparam.cpp +++ b/indra/llcommon/llinitparam.cpp @@ -100,13 +100,13 @@ namespace LLInitParam void Parser::parserWarning(const std::string& message) { if (mParseSilently) return; - llwarns << message << llendl; + LL_WARNS() << message << LL_ENDL; } void Parser::parserError(const std::string& message) { if (mParseSilently) return; - llerrs << message << llendl; + LL_ERRS() << message << LL_ENDL; } @@ -131,7 +131,7 @@ namespace LLInitParam std::string name(char_name); if ((size_t)param->mParamHandle > mMaxParamOffset) { - llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << llendl; + LL_ERRS() << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << LL_ENDL; } if (name.empty()) @@ -214,7 +214,7 @@ namespace LLInitParam { if (emit_errors) { - llwarns << "Invalid param \"" << getParamName(block_data, param) << "\"" << llendl; + LL_WARNS() << "Invalid param \"" << getParamName(block_data, param) << "\"" << LL_ENDL; } return false; } @@ -417,7 +417,7 @@ namespace LLInitParam // Block<T, Base_Class> if ((size_t)handle > block_data.mMaxParamOffset) { - llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << llendl; + LL_ERRS() << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << LL_ENDL; } ParamDescriptorPtr param_descriptor = findParamDescriptor(param); diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index f4e37d21fe..349ad530af 100755 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -31,7 +31,7 @@ #include <map> #include <typeinfo> -#include "string_table.h" +#include "llstringtable.h" #include <boost/iterator/transform_iterator.hpp> #include <boost/iterator/indirect_iterator.hpp> diff --git a/indra/llcommon/lllinkedqueue.h b/indra/llcommon/lllinkedqueue.h deleted file mode 100755 index 8336608809..0000000000 --- a/indra/llcommon/lllinkedqueue.h +++ /dev/null @@ -1,309 +0,0 @@ -/** - * @file lllinkedqueue.h - * @brief Declaration of linked queue classes. - * - * $LicenseInfo:firstyear=2003&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLLINKEDQUEUE_H -#define LL_LLLINKEDQUEUE_H - -#include "llerror.h" - -// node that actually contains the data -template <class DATA_TYPE> class LLLinkedQueueNode -{ -public: - DATA_TYPE mData; - LLLinkedQueueNode *mNextp; - LLLinkedQueueNode *mPrevp; - - -public: - LLLinkedQueueNode(); - LLLinkedQueueNode(const DATA_TYPE data); - - // destructor does not, by default, destroy associated data - // however, the mDatap must be NULL to ensure that we aren't causing memory leaks - ~LLLinkedQueueNode(); -}; - - - -template <class DATA_TYPE> class LLLinkedQueue -{ - -public: - LLLinkedQueue(); - - // destructor destroys list and nodes, but not data in nodes - ~LLLinkedQueue(); - - // Puts at end of FIFO - void push(const DATA_TYPE data); - - // Takes off front of FIFO - BOOL pop(DATA_TYPE &data); - BOOL peek(DATA_TYPE &data); - - void reset(); - - S32 getLength() const; - - BOOL isEmpty() const; - - BOOL remove(const DATA_TYPE data); - - BOOL checkData(const DATA_TYPE data) const; - -private: - // add node to end of list - // set mCurrentp to mQueuep - void addNodeAtEnd(LLLinkedQueueNode<DATA_TYPE> *nodep); - -private: - LLLinkedQueueNode<DATA_TYPE> mHead; // head node - LLLinkedQueueNode<DATA_TYPE> mTail; // tail node - S32 mLength; -}; - - -// -// Nodes -// - -template <class DATA_TYPE> -LLLinkedQueueNode<DATA_TYPE>::LLLinkedQueueNode() : - mData(), mNextp(NULL), mPrevp(NULL) -{ } - -template <class DATA_TYPE> -LLLinkedQueueNode<DATA_TYPE>::LLLinkedQueueNode(const DATA_TYPE data) : - mData(data), mNextp(NULL), mPrevp(NULL) -{ } - -template <class DATA_TYPE> -LLLinkedQueueNode<DATA_TYPE>::~LLLinkedQueueNode() -{ } - - -// -// Queue itself -// - -template <class DATA_TYPE> -LLLinkedQueue<DATA_TYPE>::LLLinkedQueue() -: mHead(), - mTail(), - mLength(0) -{ } - - -// destructor destroys list and nodes, but not data in nodes -template <class DATA_TYPE> -LLLinkedQueue<DATA_TYPE>::~LLLinkedQueue() -{ - reset(); -} - - -// put data into a node and stick it at the end of the list -template <class DATA_TYPE> -void LLLinkedQueue<DATA_TYPE>::push(const DATA_TYPE data) -{ - // make the new node - LLLinkedQueueNode<DATA_TYPE> *nodep = new LLLinkedQueueNode<DATA_TYPE>(data); - - addNodeAtEnd(nodep); -} - - -// search the list starting at mHead.mNextp and remove the link with mDatap == data -// set mCurrentp to mQueuep, or NULL if mQueuep points to node with mDatap == data -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -BOOL LLLinkedQueue<DATA_TYPE>::remove(const DATA_TYPE data) -{ - BOOL b_found = FALSE; - - LLLinkedQueueNode<DATA_TYPE> *currentp = mHead.mNextp; - - while (currentp) - { - if (currentp->mData == data) - { - b_found = TRUE; - - // if there is a next one, fix it - if (currentp->mNextp) - { - currentp->mNextp->mPrevp = currentp->mPrevp; - } - else // we are at end of list - { - mTail.mPrevp = currentp->mPrevp; - } - - // if there is a previous one, fix it - if (currentp->mPrevp) - { - currentp->mPrevp->mNextp = currentp->mNextp; - } - else // we are at beginning of list - { - mHead.mNextp = currentp->mNextp; - } - - // remove the node - delete currentp; - mLength--; - break; - } - currentp = currentp->mNextp; - } - - return b_found; -} - - -// remove all nodes from the list but do not delete associated data -template <class DATA_TYPE> -void LLLinkedQueue<DATA_TYPE>::reset() -{ - LLLinkedQueueNode<DATA_TYPE> *currentp; - LLLinkedQueueNode<DATA_TYPE> *nextp; - currentp = mHead.mNextp; - - while (currentp) - { - nextp = currentp->mNextp; - delete currentp; - currentp = nextp; - } - - // reset mHead and mCurrentp - mHead.mNextp = NULL; - mTail.mPrevp = NULL; - mLength = 0; -} - -template <class DATA_TYPE> -S32 LLLinkedQueue<DATA_TYPE>::getLength() const -{ - return mLength; -} - -template <class DATA_TYPE> -BOOL LLLinkedQueue<DATA_TYPE>::isEmpty() const -{ - return mLength <= 0; -} - -// check to see if data is in list -// set mCurrentp and mQueuep to the target of search if found, otherwise set mCurrentp to mQueuep -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -BOOL LLLinkedQueue<DATA_TYPE>::checkData(const DATA_TYPE data) const -{ - LLLinkedQueueNode<DATA_TYPE> *currentp = mHead.mNextp; - - while (currentp) - { - if (currentp->mData == data) - { - return TRUE; - } - currentp = currentp->mNextp; - } - return FALSE; -} - -template <class DATA_TYPE> -BOOL LLLinkedQueue<DATA_TYPE>::pop(DATA_TYPE &data) -{ - LLLinkedQueueNode<DATA_TYPE> *currentp; - - currentp = mHead.mNextp; - if (!currentp) - { - return FALSE; - } - - mHead.mNextp = currentp->mNextp; - if (currentp->mNextp) - { - currentp->mNextp->mPrevp = currentp->mPrevp; - } - else - { - mTail.mPrevp = currentp->mPrevp; - } - - data = currentp->mData; - delete currentp; - mLength--; - return TRUE; -} - -template <class DATA_TYPE> -BOOL LLLinkedQueue<DATA_TYPE>::peek(DATA_TYPE &data) -{ - LLLinkedQueueNode<DATA_TYPE> *currentp; - - currentp = mHead.mNextp; - if (!currentp) - { - return FALSE; - } - data = currentp->mData; - return TRUE; -} - - -////////////////////////////////////////////////////////////////////////////////////////// -// private members -////////////////////////////////////////////////////////////////////////////////////////// - - -// add node to end of list -// set mCurrentp to mQueuep -template <class DATA_TYPE> -void LLLinkedQueue<DATA_TYPE>::addNodeAtEnd(LLLinkedQueueNode<DATA_TYPE> *nodep) -{ - // add the node to the end of the list - nodep->mNextp = NULL; - nodep->mPrevp = mTail.mPrevp; - mTail.mPrevp = nodep; - - // if there's something in the list, fix its back pointer - if (nodep->mPrevp) - { - nodep->mPrevp->mNextp = nodep; - } - else // otherwise fix the head node - { - mHead.mNextp = nodep; - } - mLength++; -} - -#endif diff --git a/indra/llcommon/lllog.cpp b/indra/llcommon/lllog.cpp deleted file mode 100755 index fc4058b5c9..0000000000 --- a/indra/llcommon/lllog.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @file lllog.cpp - * @author Don - * @date 2007-11-27 - * @brief Class to log messages to syslog for streambase to process. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" -#include "lllog.h" - -#include "llapp.h" -#include "llsd.h" -#include "llsdserialize.h" - - -class LLLogImpl -{ -public: - LLLogImpl(LLApp* app) : mApp(app) {} - ~LLLogImpl() {} - - void log(const std::string &message, LLSD& info); - bool useLegacyLogMessage(const std::string &message); - -private: - LLApp* mApp; -}; - - -//@brief Function to log a message to syslog for streambase to collect. -void LLLogImpl::log(const std::string &message, LLSD& info) -{ - static S32 sequence = 0; - LLSD log_config = mApp->getOption("log-messages"); - if (log_config.has(message)) - { - LLSD message_config = log_config[message]; - if (message_config.has("use-syslog")) - { - if (! message_config["use-syslog"].asBoolean()) - { - return; - } - } - } - llinfos << "LLLOGMESSAGE (" << (sequence++) << ") " << message - << " " << LLSDNotationStreamer(info) << llendl; -} - -//@brief Function to check if specified legacy log message should be sent. -bool LLLogImpl::useLegacyLogMessage(const std::string &message) -{ - LLSD log_config = mApp->getOption("log-messages"); - if (log_config.has(message)) - { - LLSD message_config = log_config[message]; - if (message_config.has("use-legacy")) - { - return message_config["use-legacy"].asBoolean(); - } - } - return true; -} - - -LLLog::LLLog(LLApp* app) -{ - mImpl = new LLLogImpl(app); -} - -LLLog::~LLLog() -{ - delete mImpl; - mImpl = NULL; -} - -void LLLog::log(const std::string &message, LLSD& info) -{ - if (mImpl) mImpl->log(message, info); -} - -bool LLLog::useLegacyLogMessage(const std::string &message) -{ - if (mImpl) - { - return mImpl->useLegacyLogMessage(message); - } - return true; -} - diff --git a/indra/llcommon/lllog.h b/indra/llcommon/lllog.h deleted file mode 100755 index 7964412e83..0000000000 --- a/indra/llcommon/lllog.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @file lllog.h - * @author Don - * @date 2007-11-27 - * @brief Class to log messages to syslog for streambase to process. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLLOG_H -#define LL_LLLOG_H - -#include <string> - -class LLLogImpl; -class LLApp; -class LLSD; - -class LL_COMMON_API LLLog -{ -public: - LLLog(LLApp* app); - virtual ~LLLog(); - - virtual void log(const std::string &message, LLSD& info); - virtual bool useLegacyLogMessage(const std::string &message); - -private: - LLLogImpl* mImpl; -}; - -#endif /* LL_LLLOG_H */ - diff --git a/indra/llcommon/lllslconstants.h b/indra/llcommon/lllslconstants.h deleted file mode 100755 index 9f32598e61..0000000000 --- a/indra/llcommon/lllslconstants.h +++ /dev/null @@ -1,213 +0,0 @@ -/** - * @file lllslconstants.h - * @author James Cook - * @brief Constants used in lsl. - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLLSLCONSTANTS_H -#define LL_LLLSLCONSTANTS_H - -// LSL: Return flags for llGetAgentInfo -const U32 AGENT_FLYING = 0x0001; -const U32 AGENT_ATTACHMENTS = 0x0002; -const U32 AGENT_SCRIPTED = 0x0004; -const U32 AGENT_MOUSELOOK = 0x0008; -const U32 AGENT_SITTING = 0x0010; -const U32 AGENT_ON_OBJECT = 0x0020; -const U32 AGENT_AWAY = 0x0040; -const U32 AGENT_WALKING = 0x0080; -const U32 AGENT_IN_AIR = 0x0100; -const U32 AGENT_TYPING = 0x0200; -const U32 AGENT_CROUCHING = 0x0400; -const U32 AGENT_BUSY = 0x0800; -const U32 AGENT_ALWAYS_RUN = 0x1000; -const U32 AGENT_AUTOPILOT = 0x2000; - -const S32 LSL_REMOTE_DATA_CHANNEL = 1; -const S32 LSL_REMOTE_DATA_REQUEST = 2; -const S32 LSL_REMOTE_DATA_REPLY = 3; - -// Constants used in extended LSL primitive setter and getters -const S32 LSL_PRIM_TYPE_LEGACY = 1; // No longer supported. -const S32 LSL_PRIM_MATERIAL = 2; -const S32 LSL_PRIM_PHYSICS = 3; -const S32 LSL_PRIM_TEMP_ON_REZ = 4; -const S32 LSL_PRIM_PHANTOM = 5; -const S32 LSL_PRIM_POSITION = 6; -const S32 LSL_PRIM_SIZE = 7; -const S32 LSL_PRIM_ROTATION = 8; -const S32 LSL_PRIM_TYPE = 9; // Replacement for LSL_PRIM_TYPE_LEGACY -const S32 LSL_PRIM_TEXTURE = 17; -const S32 LSL_PRIM_COLOR = 18; -const S32 LSL_PRIM_BUMP_SHINY = 19; -const S32 LSL_PRIM_FULLBRIGHT = 20; -const S32 LSL_PRIM_FLEXIBLE = 21; -const S32 LSL_PRIM_TEXGEN = 22; -const S32 LSL_PRIM_POINT_LIGHT = 23; -const S32 LSL_PRIM_CAST_SHADOWS = 24; -const S32 LSL_PRIM_GLOW = 25; - -const S32 LSL_PRIM_TYPE_BOX = 0; -const S32 LSL_PRIM_TYPE_CYLINDER= 1; -const S32 LSL_PRIM_TYPE_PRISM = 2; -const S32 LSL_PRIM_TYPE_SPHERE = 3; -const S32 LSL_PRIM_TYPE_TORUS = 4; -const S32 LSL_PRIM_TYPE_TUBE = 5; -const S32 LSL_PRIM_TYPE_RING = 6; -const S32 LSL_PRIM_TYPE_SCULPT = 7; - -const S32 LSL_PRIM_HOLE_DEFAULT = 0x00; -const S32 LSL_PRIM_HOLE_CIRCLE = 0x10; -const S32 LSL_PRIM_HOLE_SQUARE = 0x20; -const S32 LSL_PRIM_HOLE_TRIANGLE= 0x30; - -const S32 LSL_PRIM_MATERIAL_STONE = 0; -const S32 LSL_PRIM_MATERIAL_METAL = 1; -const S32 LSL_PRIM_MATERIAL_GLASS = 2; -const S32 LSL_PRIM_MATERIAL_WOOD = 3; -const S32 LSL_PRIM_MATERIAL_FLESH = 4; -const S32 LSL_PRIM_MATERIAL_PLASTIC = 5; -const S32 LSL_PRIM_MATERIAL_RUBBER = 6; -const S32 LSL_PRIM_MATERIAL_LIGHT = 7; - -const S32 LSL_PRIM_SHINY_NONE = 0; -const S32 LSL_PRIM_SHINY_LOW = 1; -const S32 LSL_PRIM_SHINY_MEDIUM = 2; -const S32 LSL_PRIM_SHINY_HIGH = 3; - -const S32 LSL_PRIM_TEXGEN_DEFAULT = 0; -const S32 LSL_PRIM_TEXGEN_PLANAR = 1; - -const S32 LSL_PRIM_BUMP_NONE = 0; -const S32 LSL_PRIM_BUMP_BRIGHT = 1; -const S32 LSL_PRIM_BUMP_DARK = 2; -const S32 LSL_PRIM_BUMP_WOOD = 3; -const S32 LSL_PRIM_BUMP_BARK = 4; -const S32 LSL_PRIM_BUMP_BRICKS = 5; -const S32 LSL_PRIM_BUMP_CHECKER = 6; -const S32 LSL_PRIM_BUMP_CONCRETE = 7; -const S32 LSL_PRIM_BUMP_TILE = 8; -const S32 LSL_PRIM_BUMP_STONE = 9; -const S32 LSL_PRIM_BUMP_DISKS = 10; -const S32 LSL_PRIM_BUMP_GRAVEL = 11; -const S32 LSL_PRIM_BUMP_BLOBS = 12; -const S32 LSL_PRIM_BUMP_SIDING = 13; -const S32 LSL_PRIM_BUMP_LARGETILE = 14; -const S32 LSL_PRIM_BUMP_STUCCO = 15; -const S32 LSL_PRIM_BUMP_SUCTION = 16; -const S32 LSL_PRIM_BUMP_WEAVE = 17; - -const S32 LSL_PRIM_SCULPT_TYPE_SPHERE = 1; -const S32 LSL_PRIM_SCULPT_TYPE_TORUS = 2; -const S32 LSL_PRIM_SCULPT_TYPE_PLANE = 3; -const S32 LSL_PRIM_SCULPT_TYPE_CYLINDER = 4; -const S32 LSL_PRIM_SCULPT_TYPE_MASK = 7; -const S32 LSL_PRIM_SCULPT_FLAG_INVERT = 64; -const S32 LSL_PRIM_SCULPT_FLAG_MIRROR = 128; - -const S32 LSL_ALL_SIDES = -1; -const S32 LSL_LINK_ROOT = 1; -const S32 LSL_LINK_FIRST_CHILD = 2; -const S32 LSL_LINK_SET = -1; -const S32 LSL_LINK_ALL_OTHERS = -2; -const S32 LSL_LINK_ALL_CHILDREN = -3; -const S32 LSL_LINK_THIS = -4; - -// LSL constants for llSetForSell -const S32 SELL_NOT = 0; -const S32 SELL_ORIGINAL = 1; -const S32 SELL_COPY = 2; -const S32 SELL_CONTENTS = 3; - -// LSL constants for llSetPayPrice -const S32 PAY_PRICE_HIDE = -1; -const S32 PAY_PRICE_DEFAULT = -2; -const S32 MAX_PAY_BUTTONS = 4; -const S32 PAY_BUTTON_DEFAULT_0 = 1; -const S32 PAY_BUTTON_DEFAULT_1 = 5; -const S32 PAY_BUTTON_DEFAULT_2 = 10; -const S32 PAY_BUTTON_DEFAULT_3 = 20; - -// lsl email registration. -const S32 EMAIL_REG_SUBSCRIBE_OBJECT = 0x01; -const S32 EMAIL_REG_UNSUBSCRIBE_OBJECT = 0x02; -const S32 EMAIL_REG_UNSUBSCRIBE_SIM = 0x04; - -const S32 LIST_STAT_RANGE = 0; -const S32 LIST_STAT_MIN = 1; -const S32 LIST_STAT_MAX = 2; -const S32 LIST_STAT_MEAN = 3; -const S32 LIST_STAT_MEDIAN = 4; -const S32 LIST_STAT_STD_DEV = 5; -const S32 LIST_STAT_SUM = 6; -const S32 LIST_STAT_SUM_SQUARES = 7; -const S32 LIST_STAT_NUM_COUNT = 8; -const S32 LIST_STAT_GEO_MEAN = 9; - -const S32 STRING_TRIM_HEAD = 0x01; -const S32 STRING_TRIM_TAIL = 0x02; -const S32 STRING_TRIM = STRING_TRIM_HEAD | STRING_TRIM_TAIL; - -// llGetObjectDetails -const S32 OBJECT_UNKNOWN_DETAIL = -1; -const S32 OBJECT_NAME = 1; -const S32 OBJECT_DESC = 2; -const S32 OBJECT_POS = 3; -const S32 OBJECT_ROT = 4; -const S32 OBJECT_VELOCITY = 5; -const S32 OBJECT_OWNER = 6; -const S32 OBJECT_GROUP = 7; -const S32 OBJECT_CREATOR = 8; - -// llTextBox() magic token string - yes this is a hack. sue me. -char const* const TEXTBOX_MAGIC_TOKEN = "!!llTextBox!!"; - -// changed() event flags -const U32 CHANGED_NONE = 0x0; -const U32 CHANGED_INVENTORY = 0x1; -const U32 CHANGED_COLOR = 0x2; -const U32 CHANGED_SHAPE = 0x4; -const U32 CHANGED_SCALE = 0x8; -const U32 CHANGED_TEXTURE = 0x10; -const U32 CHANGED_LINK = 0x20; -const U32 CHANGED_ALLOWED_DROP = 0x40; -const U32 CHANGED_OWNER = 0x80; -const U32 CHANGED_REGION = 0x100; -const U32 CHANGED_TELEPORT = 0x200; -const U32 CHANGED_REGION_START = 0x400; -const U32 CHANGED_MEDIA = 0x800; - -// Possible error results -const U32 LSL_STATUS_OK = 0; -const U32 LSL_STATUS_MALFORMED_PARAMS = 1000; -const U32 LSL_STATUS_TYPE_MISMATCH = 1001; -const U32 LSL_STATUS_BOUNDS_ERROR = 1002; -const U32 LSL_STATUS_NOT_FOUND = 1003; -const U32 LSL_STATUS_NOT_SUPPORTED = 1004; -const U32 LSL_STATUS_INTERNAL_ERROR = 1999; - -// Start per-function errors below, starting at 2000: -const U32 LSL_STATUS_WHITELIST_FAILED = 2001; - -#endif diff --git a/indra/llcommon/llmap.h b/indra/llcommon/llmap.h deleted file mode 100755 index 6294a15d3b..0000000000 --- a/indra/llcommon/llmap.h +++ /dev/null @@ -1,245 +0,0 @@ -/** - * @file llmap.h - * @brief LLMap class header file - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLMAP_H -#define LL_LLMAP_H - -// llmap uses the fast stl library code in a manner consistant with LLSkipMap, et. al. - -template<class INDEX_TYPE, class MAPPED_TYPE> class LLMap -{ -private: - typedef typename std::map<INDEX_TYPE, MAPPED_TYPE> stl_map_t; - typedef typename stl_map_t::iterator stl_iter_t; - typedef typename stl_map_t::value_type stl_value_t; - - stl_map_t mStlMap; - stl_iter_t mCurIter; // *iterator = pair<const INDEX_TYPE, MAPPED_TYPE> - MAPPED_TYPE dummy_data; - INDEX_TYPE dummy_index; - -public: - LLMap() : mStlMap() - { - memset((void*)(&dummy_data), 0x0, sizeof(MAPPED_TYPE)); - memset((void*)(&dummy_index), 0x0, sizeof(INDEX_TYPE)); - mCurIter = mStlMap.begin(); - } - ~LLMap() - { - mStlMap.clear(); - } - - // use these functions to itterate through a list - void resetMap() - { - mCurIter = mStlMap.begin(); - } - - // get the current data and bump mCurrentp - // This is kind of screwy since it returns a reference; - // We have to have a dummy value for when we reach the end - // or in case we have an empty list. Presumably, this value - // will initialize to some NULL value that will end the iterator. - // We really shouldn't be using getNextData() or getNextKey() anyway... - MAPPED_TYPE &getNextData() - { - if (mCurIter == mStlMap.end()) - { - return dummy_data; - } - else - { - return (*mCurIter++).second; - } - } - - const INDEX_TYPE &getNextKey() - { - if (mCurIter == mStlMap.end()) - { - return dummy_index; - } - else - { - return (*mCurIter++).first; - } - } - - MAPPED_TYPE &getFirstData() - { - resetMap(); - return getNextData(); - } - - const INDEX_TYPE &getFirstKey() - { - resetMap(); - return getNextKey(); - } - - S32 getLength() - { - return mStlMap.size(); - } - - void addData(const INDEX_TYPE &index, MAPPED_TYPE pointed_to) - { - mStlMap.insert(stl_value_t(index, pointed_to)); - } - - void addData(const INDEX_TYPE &index) - { - mStlMap.insert(stl_value_t(index, dummy_data)); - } - - // if index doesn't exist, then insert a new node and return it - MAPPED_TYPE &getData(const INDEX_TYPE &index) - { - std::pair<stl_iter_t, bool> res; - res = mStlMap.insert(stl_value_t(index, dummy_data)); - return res.first->second; - } - - // if index doesn't exist, then insert a new node, return it, and set b_new_entry to true - MAPPED_TYPE &getData(const INDEX_TYPE &index, BOOL &b_new_entry) - { - std::pair<stl_iter_t, bool> res; - res = mStlMap.insert(stl_value_t(index, dummy_data)); - b_new_entry = res.second; - return res.first->second; - } - - // If there, returns the data. - // If not, returns NULL. - // Never adds entries to the map. - MAPPED_TYPE getIfThere(const INDEX_TYPE &index) - { - stl_iter_t iter; - iter = mStlMap.find(index); - if (iter == mStlMap.end()) - { - return (MAPPED_TYPE)0; - } - else - { - return (*iter).second; - } - } - - - // if index doesn't exist, then make a new node and return it - MAPPED_TYPE &operator[](const INDEX_TYPE &index) - { - return getData(index); - } - - // do a reverse look-up, return NULL if failed - INDEX_TYPE reverseLookup(const MAPPED_TYPE data) - { - stl_iter_t iter; - stl_iter_t end_iter; - iter = mStlMap.begin(); - end_iter = mStlMap.end(); - while (iter != end_iter) - { - if ((*iter).second == data) - return (*iter).first; - iter++; - } - return (INDEX_TYPE)0; - } - - BOOL removeData(const INDEX_TYPE &index) - { - mCurIter = mStlMap.find(index); - if (mCurIter == mStlMap.end()) - { - return FALSE; - } - else - { - stl_iter_t iter = mCurIter++; // incrament mCurIter to the next element - mStlMap.erase(iter); - return TRUE; - } - } - - // does this index exist? - BOOL checkData(const INDEX_TYPE &index) - { - stl_iter_t iter; - iter = mStlMap.find(index); - if (iter == mStlMap.end()) - { - return FALSE; - } - else - { - mCurIter = iter; - return TRUE; - } - } - - BOOL deleteData(const INDEX_TYPE &index) - { - mCurIter = mStlMap.find(index); - if (mCurIter == mStlMap.end()) - { - return FALSE; - } - else - { - stl_iter_t iter = mCurIter++; // incrament mCurIter to the next element - delete (*iter).second; - mStlMap.erase(iter); - return TRUE; - } - } - - void deleteAllData() - { - stl_iter_t iter; - stl_iter_t end_iter; - iter = mStlMap.begin(); - end_iter = mStlMap.end(); - while (iter != end_iter) - { - delete (*iter).second; - iter++; - } - mStlMap.clear(); - mCurIter = mStlMap.end(); - } - - void removeAllData() - { - mStlMap.clear(); - } -}; - - -#endif diff --git a/indra/llcommon/llnametable.h b/indra/llcommon/llnametable.h deleted file mode 100755 index d3283543f3..0000000000 --- a/indra/llcommon/llnametable.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @file llnametable.h - * @brief LLNameTable class is a table to associate pointers with string names - * - * $LicenseInfo:firstyear=2000&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLNAMETABLE_H -#define LL_LLNAMETABLE_H - -#include <map> - -#include "string_table.h" - -template <class DATA> -class LLNameTable -{ -public: - LLNameTable() - : mNameMap() - { - } - - ~LLNameTable() - { - } - - void addEntry(const std::string& name, DATA data) - { - addEntry(name.c_str(), data); - } - - void addEntry(const char *name, DATA data) - { - char *tablename = gStringTable.addString(name); - mNameMap[tablename] = data; - } - - BOOL checkName(const std::string& name) const - { - return checkName(name.c_str()); - } - - // "logically const" even though it modifies the global nametable - BOOL checkName(const char *name) const - { - char *tablename = gStringTable.addString(name); - return mNameMap.count(tablename) ? TRUE : FALSE; - } - - DATA resolveName(const std::string& name) const - { - return resolveName(name.c_str()); - } - - // "logically const" even though it modifies the global nametable - DATA resolveName(const char *name) const - { - char *tablename = gStringTable.addString(name); - const_iter_t iter = mNameMap.find(tablename); - if (iter != mNameMap.end()) - return iter->second; - else - return 0; - } - - // O(N)! (currently only used in one place... (newsim/llstate.cpp)) - const char *resolveData(const DATA &data) const - { - const_iter_t iter = mNameMap.begin(); - const_iter_t end = mNameMap.end(); - for (; iter != end; ++iter) - { - if (iter->second == data) - return iter->first; - } - return NULL; - } - - typedef std::map<const char *, DATA> name_map_t; - typedef typename std::map<const char *,DATA>::iterator iter_t; - typedef typename std::map<const char *,DATA>::const_iterator const_iter_t; - name_map_t mNameMap; -}; - -#endif diff --git a/indra/llcommon/lloptioninterface.cpp b/indra/llcommon/lloptioninterface.cpp deleted file mode 100755 index 23fae76dc0..0000000000 --- a/indra/llcommon/lloptioninterface.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file lloptioninterface.cpp - * @brief - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "lloptioninterface.h" - - -LLOptionInterface::~LLOptionInterface() -{ - -} diff --git a/indra/llcommon/lloptioninterface.h b/indra/llcommon/lloptioninterface.h deleted file mode 100755 index 93b465db32..0000000000 --- a/indra/llcommon/lloptioninterface.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file lloptioninterface.h - * @brief - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLOPTIONINTERFACE_H -#define LL_LLOPTIONINTERFACE_H - -#include "linden_common.h" - -class LLSD; -class LLOptionInterface -{ -public: - virtual ~LLOptionInterface() = 0; - virtual LLSD getOption(const std::string& name) const = 0; -}; - -#endif diff --git a/indra/llcommon/llsecondlifeurls.cpp b/indra/llcommon/llsecondlifeurls.cpp deleted file mode 100755 index 9154e05e43..0000000000 --- a/indra/llcommon/llsecondlifeurls.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @file llsecondlifeurls.cpp - * @brief Urls used in the product - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" -#include "llsecondlifeurls.h" -/* -const std::string CREATE_ACCOUNT_URL ( - "http://join.secondlife.com/"); - -const std::string MANAGE_ACCOUNT ( - "http://secondlife.com/account/"); // *TODO: NOT USED - -const std::string AUCTION_URL ( - "http://secondlife.com/auctions/auction-detail.php?id="); - -const std::string EVENTS_URL ( - "http://secondlife.com/events/"); -*/ -const std::string TIER_UP_URL ( - "http://secondlife.com/app/landtier"); // *TODO: Translate (simulator) - -const std::string DIRECTX_9_URL ( - "http://secondlife.com/support/"); // *TODO: NOT USED -/* -const std::string LAND_URL ( - "http://secondlife.com/app/landtier"); // *TODO: NOT USED - -const std::string UPGRADE_TO_PREMIUM_URL ( - "http://secondlife.com/app/upgrade/"); // *TODO: NOT USED - -const std::string AMD_AGP_URL ( - "http://secondlife.com/support/"); // *TODO: NOT USED - -const std::string VIA_URL ( - "http://secondlife.com/support/"); // *TODO: NOT USED - -const std::string SUPPORT_URL ( - "http://secondlife.com/support/"); - -const std::string INTEL_CHIPSET_URL ( - "http://secondlife.com/support/"); // *TODO: NOT USED - -const std::string SIS_CHIPSET_URL ( - "http://secondlife.com/support/"); // *TODO: NOT USED - -const std::string BLOGS_URL ( - "http://blog.secondlife.com/"); // *TODO: NOT USED - -const std::string BUY_CURRENCY_URL ( - "http://secondlife.com/app/currency/"); - -const std::string LSL_DOC_URL ( - "http://secondlife.com/app/lsldoc/"); // *TODO: NOT USED - -const std::string SL_KB_URL ( - "http://secondlife.com/knowledgebase/"); // *TODO: NOT USED - -const std::string RELEASE_NOTES_BASE_URL ( - "http://secondlife.com/app/releasenotes/"); -*/ - diff --git a/indra/llcommon/llsecondlifeurls.h b/indra/llcommon/llsecondlifeurls.h deleted file mode 100755 index 62f357ffed..0000000000 --- a/indra/llcommon/llsecondlifeurls.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @file llsecondlifeurls.h - * @brief Global URLs to pages on our web site - * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLSECONDLIFEURLS_H -#define LL_LLSECONDLIFEURLS_H -/* -// Account registration web page -LL_COMMON_API extern const std::string CREATE_ACCOUNT_URL; - -// Manage Account -LL_COMMON_API extern const std::string MANAGE_ACCOUNT; - -LL_COMMON_API extern const std::string AUCTION_URL; - -LL_COMMON_API extern const std::string EVENTS_URL; -*/ -// Tier up to a new land level. -LL_COMMON_API extern const std::string TIER_UP_URL; - - -// Tier up to a new land level. -LL_COMMON_API extern const std::string LAND_URL; - -// How to get DirectX 9 -LL_COMMON_API extern const std::string DIRECTX_9_URL; - -/* -// Upgrade from basic membership to premium membership -LL_COMMON_API extern const std::string UPGRADE_TO_PREMIUM_URL; - - -// Out of date VIA chipset -LL_COMMON_API extern const std::string VIA_URL; - -// Support URL -LL_COMMON_API extern const std::string SUPPORT_URL; - -// Linden Blogs page -LL_COMMON_API extern const std::string BLOGS_URL; - -// Currency page -LL_COMMON_API extern const std::string BUY_CURRENCY_URL; - -// LSL script wiki -LL_COMMON_API extern const std::string LSL_DOC_URL; - -// SL KnowledgeBase page -LL_COMMON_API extern const std::string SL_KB_URL; - -// Release Notes Redirect URL for Server and Viewer -LL_COMMON_API extern const std::string RELEASE_NOTES_BASE_URL; -*/ -#endif diff --git a/indra/llcommon/llstatenums.h b/indra/llcommon/llstatenums.h deleted file mode 100755 index ab9b6709e8..0000000000 --- a/indra/llcommon/llstatenums.h +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @file llstatenums.h - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLSTATENUMS_H -#define LL_LLSTATENUMS_H - -enum ESimStatID -{ - LL_SIM_STAT_TIME_DILATION = 0, - LL_SIM_STAT_FPS = 1, - LL_SIM_STAT_PHYSFPS = 2, - LL_SIM_STAT_AGENTUPS = 3, - LL_SIM_STAT_FRAMEMS = 4, - LL_SIM_STAT_NETMS = 5, - LL_SIM_STAT_SIMOTHERMS = 6, - LL_SIM_STAT_SIMPHYSICSMS = 7, - LL_SIM_STAT_AGENTMS = 8, - LL_SIM_STAT_IMAGESMS = 9, - LL_SIM_STAT_SCRIPTMS = 10, - LL_SIM_STAT_NUMTASKS = 11, - LL_SIM_STAT_NUMTASKSACTIVE = 12, - LL_SIM_STAT_NUMAGENTMAIN = 13, - LL_SIM_STAT_NUMAGENTCHILD = 14, - LL_SIM_STAT_NUMSCRIPTSACTIVE = 15, - LL_SIM_STAT_LSLIPS = 16, - LL_SIM_STAT_INPPS = 17, - LL_SIM_STAT_OUTPPS = 18, - LL_SIM_STAT_PENDING_DOWNLOADS = 19, - LL_SIM_STAT_PENDING_UPLOADS = 20, - LL_SIM_STAT_VIRTUAL_SIZE_KB = 21, - LL_SIM_STAT_RESIDENT_SIZE_KB = 22, - LL_SIM_STAT_PENDING_LOCAL_UPLOADS = 23, - LL_SIM_STAT_TOTAL_UNACKED_BYTES = 24, - LL_SIM_STAT_PHYSICS_PINNED_TASKS = 25, - LL_SIM_STAT_PHYSICS_LOD_TASKS = 26, - LL_SIM_STAT_SIMPHYSICSSTEPMS = 27, - LL_SIM_STAT_SIMPHYSICSSHAPEMS = 28, - LL_SIM_STAT_SIMPHYSICSOTHERMS = 29, - LL_SIM_STAT_SIMPHYSICSMEMORY = 30, - LL_SIM_STAT_SCRIPT_EPS = 31, - LL_SIM_STAT_SIMSPARETIME = 32, - LL_SIM_STAT_SIMSLEEPTIME = 33, - LL_SIM_STAT_IOPUMPTIME = 34, - LL_SIM_STAT_PCTSCRIPTSRUN = 35, - LL_SIM_STAT_REGION_IDLE = 36, // dataserver only - LL_SIM_STAT_REGION_IDLE_POSSIBLE = 37, // dataserver only - LL_SIM_STAT_SIMAISTEPTIMEMS = 38, - LL_SIM_STAT_SKIPPEDAISILSTEPS_PS = 39, - LL_SIM_STAT_PCTSTEPPEDCHARACTERS = 40 - -}; - -#endif diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index 424138dad1..143e71f40c 100755 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -33,7 +33,6 @@ #include <vector> #include <list> #include <set> -#include <deque> #include <typeinfo> // Use to compare the first element only of a pair @@ -125,7 +124,7 @@ struct DeletePairedPointerArray // compiler, the second unary_function template parameter can be set // to void. // -// Here's a snippit showing how you use this object: +// Here's a snippet showing how you use this object: // // typedef std::map<int, widget*> map_type; // map_type widget_map; @@ -170,6 +169,49 @@ struct CopyNewPointer } }; +template<typename T, typename ALLOC> +void delete_and_clear(std::list<T*, ALLOC>& list) +{ + std::for_each(list.begin(), list.end(), DeletePointer()); + list.clear(); +} + +template<typename T, typename ALLOC> +void delete_and_clear(std::vector<T*, ALLOC>& vector) +{ + std::for_each(vector.begin(), vector.end(), DeletePointer()); + vector.clear(); +} + +template<typename T, typename COMPARE, typename ALLOC> +void delete_and_clear(std::set<T*, COMPARE, ALLOC>& set) +{ + std::for_each(set.begin(), set.end(), DeletePointer()); + set.clear(); +} + +template<typename K, typename V, typename COMPARE, typename ALLOC> +void delete_and_clear(std::map<K, V*, COMPARE, ALLOC>& map) +{ + std::for_each(map.begin(), map.end(), DeletePairedPointer()); + map.clear(); +} + +template<typename T> +void delete_and_clear(T*& ptr) +{ + delete ptr; + ptr = NULL; +} + + +template<typename T> +void delete_and_clear_array(T*& ptr) +{ + delete[] ptr; + ptr = NULL; +} + // Simple function to help with finding pointers in maps. // For example: // typedef map_t; @@ -229,7 +271,6 @@ inline T get_if_there(const std::map<K,T>& inmap, const K& key, T default_value) } }; -// Useful for replacing the removeObj() functionality of LLDynamicArray // Example: // for (std::vector<T>::iterator iter = mList.begin(); iter != mList.end(); ) // { @@ -238,8 +279,8 @@ inline T get_if_there(const std::map<K,T>& inmap, const K& key, T default_value) // else // ++iter; // } -template <typename T, typename Iter> -inline Iter vector_replace_with_last(std::vector<T>& invec, Iter iter) +template <typename T> +inline typename std::vector<T>::iterator vector_replace_with_last(std::vector<T>& invec, typename std::vector<T>::iterator iter) { typename std::vector<T>::iterator last = invec.end(); --last; if (iter == invec.end()) @@ -259,7 +300,6 @@ inline Iter vector_replace_with_last(std::vector<T>& invec, Iter iter) } }; -// Useful for replacing the removeObj() functionality of LLDynamicArray // Example: // vector_replace_with_last(mList, x); template <typename T> @@ -522,4 +562,151 @@ namespace std }; } // std + +/** + * Implementation for ll_template_cast() (q.v.). + * + * Default implementation: trying to cast two completely unrelated types + * returns 0. Typically you'd specify T and U as pointer types, but in fact T + * can be any type that can be initialized with 0. + */ +template <typename T, typename U> +struct ll_template_cast_impl +{ + T operator()(U) + { + return 0; + } +}; + +/** + * ll_template_cast<T>(some_value) is for use in a template function when + * some_value might be of arbitrary type, but you want to recognize type T + * specially. + * + * It's designed for use with pointer types. Example: + * @code + * struct SpecialClass + * { + * void someMethod(const std::string&) const; + * }; + * + * template <class REALCLASS> + * void somefunc(const REALCLASS& instance) + * { + * const SpecialClass* ptr = ll_template_cast<const SpecialClass*>(&instance); + * if (ptr) + * { + * ptr->someMethod("Call method only available on SpecialClass"); + * } + * } + * @endcode + * + * Why is this better than dynamic_cast<>? Because unless OtherClass is + * polymorphic, the following won't even compile (gcc 4.0.1): + * @code + * OtherClass other; + * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&other); + * @endcode + * to say nothing of this: + * @code + * void function(int); + * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&function); + * @endcode + * ll_template_cast handles these kinds of cases by returning 0. + */ +template <typename T, typename U> +T ll_template_cast(U value) +{ + return ll_template_cast_impl<T, U>()(value); +} + +/** + * Implementation for ll_template_cast() (q.v.). + * + * Implementation for identical types: return same value. + */ +template <typename T> +struct ll_template_cast_impl<T, T> +{ + T operator()(T value) + { + return value; + } +}; + +/** + * LL_TEMPLATE_CONVERTIBLE(dest, source) asserts that, for a value @c s of + * type @c source, <tt>ll_template_cast<dest>(s)</tt> will return @c s -- + * presuming that @c source can be converted to @c dest by the normal rules of + * C++. + * + * By default, <tt>ll_template_cast<dest>(s)</tt> will return 0 unless @c s's + * type is literally identical to @c dest. (This is because of the + * straightforward application of template specialization rules.) That can + * lead to surprising results, e.g.: + * + * @code + * Foo myFoo; + * const Foo* fooptr = ll_template_cast<const Foo*>(&myFoo); + * @endcode + * + * Here @c fooptr will be 0 because <tt>&myFoo</tt> is of type <tt>Foo*</tt> + * -- @em not <tt>const Foo*</tt>. (Declaring <tt>const Foo myFoo;</tt> would + * force the compiler to do the right thing.) + * + * More disappointingly: + * @code + * struct Base {}; + * struct Subclass: public Base {}; + * Subclass object; + * Base* ptr = ll_template_cast<Base*>(&object); + * @endcode + * + * Here @c ptr will be 0 because <tt>&object</tt> is of type + * <tt>Subclass*</tt> rather than <tt>Base*</tt>. We @em want this cast to + * succeed, but without our help ll_template_cast can't recognize it. + * + * The following would suffice: + * @code + * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*); + * ... + * Base* ptr = ll_template_cast<Base*>(&object); + * @endcode + * + * However, as noted earlier, this is easily fooled: + * @code + * const Base* ptr = ll_template_cast<const Base*>(&object); + * @endcode + * would still produce 0 because we haven't yet seen: + * @code + * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*); + * @endcode + * + * @TODO + * This macro should use Boost type_traits facilities for stripping and + * re-adding @c const and @c volatile qualifiers so that invoking + * LL_TEMPLATE_CONVERTIBLE(dest, source) will automatically generate all + * permitted permutations. It's really not fair to the coder to require + * separate: + * @code + * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*); + * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*); + * LL_TEMPLATE_CONVERTIBLE(const Base*, const Subclass*); + * @endcode + * + * (Naturally we omit <tt>LL_TEMPLATE_CONVERTIBLE(Base*, const Subclass*)</tt> + * because that's not permitted by normal C++ assignment anyway.) + */ +#define LL_TEMPLATE_CONVERTIBLE(DEST, SOURCE) \ +template <> \ +struct ll_template_cast_impl<DEST, SOURCE> \ +{ \ + DEST operator()(SOURCE wrapper) \ + { \ + return wrapper; \ + } \ +} + + #endif // LL_LLSTL_H diff --git a/indra/llcommon/llstringtable.cpp b/indra/llcommon/llstringtable.cpp index 7ad3805351..f288999964 100755 --- a/indra/llcommon/llstringtable.cpp +++ b/indra/llcommon/llstringtable.cpp @@ -317,7 +317,7 @@ void LLStringTable::removeString(const char *str) mUniqueEntries--; if (mUniqueEntries < 0) { - llerror("LLStringTable:removeString trying to remove too many strings!", 0); + LL_ERRS() << "LLStringTable:removeString trying to remove too many strings!" << LL_ENDL; } delete iter->second; mStringHash.erase(iter); @@ -343,7 +343,7 @@ void LLStringTable::removeString(const char *str) mUniqueEntries--; if (mUniqueEntries < 0) { - llerror("LLStringTable:removeString trying to remove too many strings!", 0); + LL_ERRS() << "LLStringTable:removeString trying to remove too many strings!" << LL_ENDL; } strlist->remove(entry); delete entry; diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 25383fc4d8..8f5a886a37 100755 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -43,7 +43,6 @@ // // Locally used constants // -const U32 SEC_PER_DAY = 86400; const F64 SEC_TO_MICROSEC = 1000000.f; const U64 SEC_TO_MICROSEC_U64 = 1000000; const F64 USEC_TO_SEC_F64 = 0.000001; @@ -204,6 +203,8 @@ F64 calc_clock_frequency(unsigned int uiMeasureMSecs) return 1000000.0; // microseconds, so 1 MHz. } +const U64 SEC_TO_MICROSEC_U64 = 1000000; + U64 get_clock_count() { // Linux clocks are in microseconds @@ -226,7 +227,7 @@ void update_clock_frequencies() // returns a U64 number that represents the number of // microseconds since the unix epoch - Jan 1, 1970 -U64 totalTime() +LLUnitImplicit<U64, LLUnits::Microseconds> totalTime() { U64 current_clock_count = get_clock_count(); if (!gTotalTimeClockCount) @@ -263,7 +264,7 @@ U64 totalTime() } // Return the total clock tick count in microseconds. - return (U64)(gTotalTimeClockCount*gClocksToMicroseconds); + return LLUnits::Microseconds::fromValue(gTotalTimeClockCount*gClocksToMicroseconds); } @@ -375,7 +376,7 @@ LLUnitImplicit<F32, LLUnits::Seconds> LLTimer::getElapsedTimeAndResetF32() /////////////////////////////////////////////////////////////////////////////// -void LLTimer::setTimerExpirySec(F32 expiration) +void LLTimer::setTimerExpirySec(LLUnitImplicit<F32, LLUnits::Seconds> expiration) { mExpirationTicks = get_clock_count() + (U64)((F32)(expiration * gClockFrequency)); diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index f2dc59e405..1f2c56432b 100755 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -91,7 +91,7 @@ public: void stop() { mStarted = FALSE; } void reset(); // Resets the timer void setLastClockCount(U64 current_count); // Sets the timer so that the next elapsed call will be relative to this time - void setTimerExpirySec(F32 expiration); + void setTimerExpirySec(LLUnitImplicit<F32, LLUnits::Seconds> expiration); BOOL checkExpirationAndReset(F32 expiration); BOOL hasExpired() const; LLUnitImplicit<F32, LLUnits::Seconds> getElapsedTimeAndResetF32(); // Returns elapsed time in seconds with reset @@ -171,6 +171,6 @@ LL_COMMON_API struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_dayli LL_COMMON_API void microsecondsToTimecodeString(U64 current_time, std::string& tcstring); LL_COMMON_API void secondsToTimecodeString(F32 current_time, std::string& tcstring); -U64 LL_COMMON_API totalTime(); // Returns current system time in microseconds +LLUnitImplicit<U64, LLUnits::Microseconds> LL_COMMON_API totalTime(); // Returns current system time in microseconds #endif diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h index d6d8d9da6a..781a4ab731 100644 --- a/indra/llcommon/llunit.h +++ b/indra/llcommon/llunit.h @@ -29,7 +29,7 @@ #include "stdtypes.h" #include "llpreprocessor.h" -#include "llerrorlegacy.h" +#include "llerror.h" template<typename STORAGE_TYPE, typename UNIT_TYPE> struct LLUnit @@ -266,13 +266,29 @@ LLUnit<STORAGE_TYPE, UNIT_TYPE> operator + (SCALAR_TYPE first, LLUnit<STORAGE_TY } template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2> -LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnit<STORAGE_TYPE2, UNIT_TYPE2> second) +LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second) +{ + LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first); + result += second; + return result; +} + +template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2> +LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second) { LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first); result += second; return result; } +template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2> +LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnit<STORAGE_TYPE2, UNIT_TYPE2> second) +{ + LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first); + result += LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1>(second); + return result; +} + template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE> LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator + (LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second) { @@ -281,10 +297,10 @@ LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator + (LLUnitImplicit<STORAGE_TYPE, return result; } -template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2> -LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second) +template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE> +LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator + (SCALAR_TYPE first, LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> second) { - LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first); + LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> result(first); result += second; return result; } @@ -324,6 +340,22 @@ LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator - (LLUnitImplicit<STORAGE_TYP return result; } +template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2> +LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator - (LLUnit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second) +{ + LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first); + result -= second; + return result; +} + +template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2> +LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator - (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnit<STORAGE_TYPE2, UNIT_TYPE2> second) +{ + LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> result(first); + result -= LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1>(second); + return result; +} + template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE> LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator - (LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second) { @@ -343,18 +375,6 @@ LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator - (SCALAR_TYPE first, LLUnitImp // // operator * // -template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE> -LLUnit<STORAGE_TYPE, UNIT_TYPE> operator * (SCALAR_TYPE first, LLUnit<STORAGE_TYPE, UNIT_TYPE> second) -{ - return LLUnit<STORAGE_TYPE, UNIT_TYPE>((STORAGE_TYPE)(first * second.value())); -} - -template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE> -LLUnit<STORAGE_TYPE, UNIT_TYPE> operator * (LLUnit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second) -{ - return LLUnit<STORAGE_TYPE, UNIT_TYPE>((STORAGE_TYPE)(first.value() * second)); -} - template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2> LLUnit<STORAGE_TYPE1, UNIT_TYPE1> operator * (LLUnit<STORAGE_TYPE1, UNIT_TYPE1>, LLUnit<STORAGE_TYPE2, UNIT_TYPE2>) { @@ -364,15 +384,15 @@ LLUnit<STORAGE_TYPE1, UNIT_TYPE1> operator * (LLUnit<STORAGE_TYPE1, UNIT_TYPE1>, } template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE> -LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator * (SCALAR_TYPE first, LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> second) +LLUnit<STORAGE_TYPE, UNIT_TYPE> operator * (LLUnit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second) { - return LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE>(first * second.value()); + return LLUnit<STORAGE_TYPE, UNIT_TYPE>((STORAGE_TYPE)(first.value() * second)); } template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE> -LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator * (LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second) +LLUnit<STORAGE_TYPE, UNIT_TYPE> operator * (SCALAR_TYPE first, LLUnit<STORAGE_TYPE, UNIT_TYPE> second) { - return LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE>(first.value() * second); + return LLUnit<STORAGE_TYPE, UNIT_TYPE>((STORAGE_TYPE)(first * second.value())); } template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2> @@ -383,6 +403,19 @@ LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> operator * (LLUnitImplicit<STORAGE_TYP return LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1>(); } +template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE> +LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator * (LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> first, SCALAR_TYPE second) +{ + return LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE>(first.value() * second); +} + +template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE> +LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> operator * (SCALAR_TYPE first, LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> second) +{ + return LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE>(first * second.value()); +} + + // // operator / // @@ -416,6 +449,18 @@ STORAGE_TYPE1 operator / (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUni return STORAGE_TYPE1(first.value() / first.convert(second)); } +template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2> +STORAGE_TYPE1 operator / (LLUnit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnitImplicit<STORAGE_TYPE2, UNIT_TYPE2> second) +{ + return STORAGE_TYPE1(first.value() / first.convert(second)); +} + +template<typename STORAGE_TYPE1, typename UNIT_TYPE1, typename STORAGE_TYPE2, typename UNIT_TYPE2> +STORAGE_TYPE1 operator / (LLUnitImplicit<STORAGE_TYPE1, UNIT_TYPE1> first, LLUnit<STORAGE_TYPE2, UNIT_TYPE2> second) +{ + return STORAGE_TYPE1(first.value() / first.convert(second)); +} + #define COMPARISON_OPERATORS(op) \ template<typename STORAGE_TYPE, typename UNIT_TYPE, typename SCALAR_TYPE> \ bool operator op (SCALAR_TYPE first, LLUnit<STORAGE_TYPE, UNIT_TYPE> second) \ @@ -591,6 +636,7 @@ LL_DECLARE_DERIVED_UNIT(Mibibits, * 1024, Gibibits, "Gib"); LL_DECLARE_BASE_UNIT(Seconds, "s"); LL_DECLARE_DERIVED_UNIT(Seconds, * 60, Minutes, "min"); LL_DECLARE_DERIVED_UNIT(Minutes, * 60, Hours, "h"); +LL_DECLARE_DERIVED_UNIT(Hours, * 24, Days, "d"); LL_DECLARE_DERIVED_UNIT(Seconds, / 1000, Milliseconds, "ms"); LL_DECLARE_DERIVED_UNIT(Milliseconds, / 1000, Microseconds, "\x09\x3cs"); LL_DECLARE_DERIVED_UNIT(Microseconds, / 1000, Nanoseconds, "ns"); diff --git a/indra/llcommon/llversionserver.h b/indra/llcommon/llversionserver.h deleted file mode 100755 index ef68a0eaf5..0000000000 --- a/indra/llcommon/llversionserver.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @file llversionserver.h - * @brief - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLVERSIONSERVER_H -#define LL_LLVERSIONSERVER_H - -const S32 LL_VERSION_MAJOR = 2; -const S32 LL_VERSION_MINOR = 1; -const S32 LL_VERSION_PATCH = 0; -const S32 LL_VERSION_BUILD = 264760; - -const char * const LL_CHANNEL = "Second Life Server"; - - -#endif diff --git a/indra/llcommon/roles_constants.h b/indra/llcommon/roles_constants.h deleted file mode 100755 index effd15ea72..0000000000 --- a/indra/llcommon/roles_constants.h +++ /dev/null @@ -1,192 +0,0 @@ -/** - * @file roles_constants.h - * @brief General Roles Constants - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_ROLES_CONSTANTS_H -#define LL_ROLES_CONSTANTS_H - -// This value includes the everyone group. -const S32 MAX_ROLES = 10; - -enum LLRoleMemberChangeType -{ - RMC_ADD, - RMC_REMOVE, - RMC_NONE -}; - -enum LLRoleChangeType -{ - RC_UPDATE_NONE, - RC_UPDATE_DATA, - RC_UPDATE_POWERS, - RC_UPDATE_ALL, - RC_CREATE, - RC_DELETE -}; - -// -// Powers -// - -// KNOWN HOLES: use these for any single bit powers you need -// bit 0x1 << 46 -// bit 0x1 << 49 and above - -// These powers were removed to make group roles simpler -// bit 0x1 << 41 (GP_ACCOUNTING_VIEW) -// bit 0x1 << 46 (GP_PROPOSAL_VIEW) - -const U64 GP_NO_POWERS = 0x0; -const U64 GP_ALL_POWERS = 0xFFFFFFFFFFFFFFFFLL; - -// Membership -const U64 GP_MEMBER_INVITE = 0x1 << 1; // Invite member -const U64 GP_MEMBER_EJECT = 0x1 << 2; // Eject member from group -const U64 GP_MEMBER_OPTIONS = 0x1 << 3; // Toggle "Open enrollment" and change "Signup Fee" -const U64 GP_MEMBER_VISIBLE_IN_DIR = 0x1LL << 47; - -// Roles -const U64 GP_ROLE_CREATE = 0x1 << 4; // Create new roles -const U64 GP_ROLE_DELETE = 0x1 << 5; // Delete roles -const U64 GP_ROLE_PROPERTIES = 0x1 << 6; // Change Role Names, Titles, and Descriptions (Of roles the user is in, only, or any role in group?) -const U64 GP_ROLE_ASSIGN_MEMBER_LIMITED = 0x1 << 7; // Assign Member to a Role that the assigner is in -const U64 GP_ROLE_ASSIGN_MEMBER = 0x1 << 8; // Assign Member to Role -const U64 GP_ROLE_REMOVE_MEMBER = 0x1 << 9; // Remove Member from Role -const U64 GP_ROLE_CHANGE_ACTIONS = 0x1 << 10; // Change actions a role can perform - -// Group Identity -const U64 GP_GROUP_CHANGE_IDENTITY = 0x1 << 11; // Charter, insignia, 'Show In Group List', 'Publish on the web', 'Mature', all 'Show Member In Group Profile' checkboxes - -// Parcel Management -const U64 GP_LAND_DEED = 0x1 << 12; // Deed Land and Buy Land for Group -const U64 GP_LAND_RELEASE = 0x1 << 13; // Release Land (to Gov. Linden) -const U64 GP_LAND_SET_SALE_INFO = 0x1 << 14; // Set for sale info (Toggle "For Sale", Set Price, Set Target, Toggle "Sell objects with the land") -const U64 GP_LAND_DIVIDE_JOIN = 0x1 << 15; // Divide and Join Parcels - -// Parcel Identity -const U64 GP_LAND_FIND_PLACES = 0x1 << 17; // Toggle "Show in Find Places" and Set Category. -const U64 GP_LAND_CHANGE_IDENTITY = 0x1 << 18; // Change Parcel Identity: Parcel Name, Parcel Description, Snapshot, 'Publish on the web', and 'Mature' checkbox -const U64 GP_LAND_SET_LANDING_POINT = 0x1 << 19; // Set Landing Point - -// Parcel Settings -const U64 GP_LAND_CHANGE_MEDIA = 0x1 << 20; // Change Media Settings -const U64 GP_LAND_EDIT = 0x1 << 21; // Toggle Edit Land -const U64 GP_LAND_OPTIONS = 0x1 << 22; // Toggle Set Home Point, Fly, Outside Scripts, Create/Edit Objects, Landmark, and Damage checkboxes - -// Parcel Powers -const U64 GP_LAND_ALLOW_EDIT_LAND = 0x1 << 23; // Bypass Edit Land Restriction -const U64 GP_LAND_ALLOW_FLY = 0x1 << 24; // Bypass Fly Restriction -const U64 GP_LAND_ALLOW_CREATE = 0x1 << 25; // Bypass Create/Edit Objects Restriction -const U64 GP_LAND_ALLOW_LANDMARK = 0x1 << 26; // Bypass Landmark Restriction -const U64 GP_LAND_ALLOW_SET_HOME = 0x1 << 28; // Bypass Set Home Point Restriction -const U64 GP_LAND_ALLOW_HOLD_EVENT = 0x1LL << 41; // Allowed to hold events on group-owned land - - -// Parcel Access -const U64 GP_LAND_MANAGE_ALLOWED = 0x1 << 29; // Manage Allowed List -const U64 GP_LAND_MANAGE_BANNED = 0x1 << 30; // Manage Banned List -const U64 GP_LAND_MANAGE_PASSES = 0x1LL << 31; // Change Sell Pass Settings -const U64 GP_LAND_ADMIN = 0x1LL << 32; // Eject and Freeze Users on the land - -// Parcel Content -const U64 GP_LAND_RETURN_GROUP_SET = 0x1LL << 33; // Return objects on parcel that are set to group -const U64 GP_LAND_RETURN_NON_GROUP = 0x1LL << 34; // Return objects on parcel that are not set to group -const U64 GP_LAND_RETURN_GROUP_OWNED= 0x1LL << 48; // Return objects on parcel that are owned by the group - -// Select a power-bit based on an object's relationship to a parcel. -const U64 GP_LAND_RETURN = GP_LAND_RETURN_GROUP_OWNED - | GP_LAND_RETURN_GROUP_SET - | GP_LAND_RETURN_NON_GROUP; - -const U64 GP_LAND_GARDENING = 0x1LL << 35; // Parcel Gardening - plant and move linden trees - -// Object Management -const U64 GP_OBJECT_DEED = 0x1LL << 36; // Deed Object -const U64 GP_OBJECT_MANIPULATE = 0x1LL << 38; // Manipulate Group Owned Objects (Move, Copy, Mod) -const U64 GP_OBJECT_SET_SALE = 0x1LL << 39; // Set Group Owned Object for Sale - -// Accounting -const U64 GP_ACCOUNTING_ACCOUNTABLE = 0x1LL << 40; // Pay Group Liabilities and Receive Group Dividends - -// Notices -const U64 GP_NOTICES_SEND = 0x1LL << 42; // Send Notices -const U64 GP_NOTICES_RECEIVE = 0x1LL << 43; // Receive Notices and View Notice History - -// Proposals -// TODO: _DEPRECATED suffix as part of vote removal - DEV-24856: -const U64 GP_PROPOSAL_START = 0x1LL << 44; // Start Proposal -// TODO: _DEPRECATED suffix as part of vote removal - DEV-24856: -const U64 GP_PROPOSAL_VOTE = 0x1LL << 45; // Vote on Proposal - -// Group chat moderation related -const U64 GP_SESSION_JOIN = 0x1LL << 16; //can join session -const U64 GP_SESSION_VOICE = 0x1LL << 27; //can hear/talk -const U64 GP_SESSION_MODERATOR = 0x1LL << 37; //can mute people's session - -const U64 GP_DEFAULT_MEMBER = GP_ACCOUNTING_ACCOUNTABLE - | GP_LAND_ALLOW_SET_HOME - | GP_NOTICES_RECEIVE - | GP_SESSION_JOIN - | GP_SESSION_VOICE - ; - -const U64 GP_DEFAULT_OFFICER = GP_DEFAULT_MEMBER // Superset of GP_DEFAULT_MEMBER - | GP_GROUP_CHANGE_IDENTITY - | GP_LAND_ADMIN - | GP_LAND_ALLOW_EDIT_LAND - | GP_LAND_ALLOW_FLY - | GP_LAND_ALLOW_CREATE - | GP_LAND_ALLOW_LANDMARK - | GP_LAND_CHANGE_IDENTITY - | GP_LAND_CHANGE_MEDIA - | GP_LAND_DEED - | GP_LAND_DIVIDE_JOIN - | GP_LAND_EDIT - | GP_LAND_FIND_PLACES - | GP_LAND_GARDENING - | GP_LAND_MANAGE_ALLOWED - | GP_LAND_MANAGE_BANNED - | GP_LAND_MANAGE_PASSES - | GP_LAND_OPTIONS - | GP_LAND_RELEASE - | GP_LAND_RETURN_GROUP_OWNED - | GP_LAND_RETURN_GROUP_SET - | GP_LAND_RETURN_NON_GROUP - | GP_LAND_SET_LANDING_POINT - | GP_LAND_SET_SALE_INFO - | GP_MEMBER_EJECT - | GP_MEMBER_INVITE - | GP_MEMBER_OPTIONS - | GP_MEMBER_VISIBLE_IN_DIR - | GP_NOTICES_SEND - | GP_OBJECT_DEED - | GP_OBJECT_MANIPULATE - | GP_OBJECT_SET_SALE - | GP_ROLE_ASSIGN_MEMBER_LIMITED - | GP_ROLE_PROPERTIES - | GP_SESSION_MODERATOR - ; -#endif diff --git a/indra/llcommon/stdenums.h b/indra/llcommon/stdenums.h deleted file mode 100755 index efcbe76795..0000000000 --- a/indra/llcommon/stdenums.h +++ /dev/null @@ -1,137 +0,0 @@ -/** - * @file stdenums.h - * @brief Enumerations for indra. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_STDENUMS_H -#define LL_STDENUMS_H - -//---------------------------------------------------------------------------- -// DEPRECATED - create new, more specific files for shared enums/constants -//---------------------------------------------------------------------------- - -// this enum is used by the llview.h (viewer) and the llassetstorage.h (viewer and sim) -enum EDragAndDropType -{ - DAD_NONE = 0, - DAD_TEXTURE = 1, - DAD_SOUND = 2, - DAD_CALLINGCARD = 3, - DAD_LANDMARK = 4, - DAD_SCRIPT = 5, - DAD_CLOTHING = 6, - DAD_OBJECT = 7, - DAD_NOTECARD = 8, - DAD_CATEGORY = 9, - DAD_ROOT_CATEGORY = 10, - DAD_BODYPART = 11, - DAD_ANIMATION = 12, - DAD_GESTURE = 13, - DAD_LINK = 14, - DAD_MESH = 15, - DAD_WIDGET = 16, - DAD_PERSON = 17, - DAD_COUNT = 18, // number of types in this enum -}; - -// Reasons for drags to be denied. -// ordered by priority for multi-drag -enum EAcceptance -{ - ACCEPT_POSTPONED, // we are asynchronously determining acceptance - ACCEPT_NO, // Uninformative, general purpose denial. - ACCEPT_NO_LOCKED, // Operation would be valid, but permissions are set to disallow it. - ACCEPT_YES_COPY_SINGLE, // We'll take a copy of a single item - ACCEPT_YES_SINGLE, // Accepted. OK to drag and drop single item here. - ACCEPT_YES_COPY_MULTI, // We'll take a copy of multiple items - ACCEPT_YES_MULTI // Accepted. OK to drag and drop multiple items here. -}; - -// This is used by the DeRezObject message to determine where to put -// derezed tasks. -enum EDeRezDestination -{ - DRD_SAVE_INTO_AGENT_INVENTORY = 0, - DRD_ACQUIRE_TO_AGENT_INVENTORY = 1, // try to leave copy in world - DRD_SAVE_INTO_TASK_INVENTORY = 2, - DRD_ATTACHMENT = 3, - DRD_TAKE_INTO_AGENT_INVENTORY = 4, // delete from world - DRD_FORCE_TO_GOD_INVENTORY = 5, // force take copy - DRD_TRASH = 6, - DRD_ATTACHMENT_TO_INV = 7, - DRD_ATTACHMENT_EXISTS = 8, - DRD_RETURN_TO_OWNER = 9, // back to owner's inventory - DRD_RETURN_TO_LAST_OWNER = 10, // deeded object back to last owner's inventory - - DRD_COUNT = 11 -}; - - -// This is used by the return to owner code to determine the reason -// that this object is being returned. -enum EReturnReason -{ - RR_GENERIC = 0, - RR_SANDBOX = 1, - RR_PARCEL_OWNER = 2, - RR_PARCEL_AUTO = 3, - RR_PARCEL_FULL = 4, - RR_OFF_WORLD = 5, - - RR_COUNT = 6 -}; - -// This is used for filling in the first byte of the ExtraID field of -// the ObjectProperties message. -enum EObjectPropertiesExtraID -{ - OPEID_NONE = 0, - OPEID_ASSET_ID = 1, - OPEID_FROM_TASK_ID = 2, - - OPEID_COUNT = 3 -}; - -enum EAddPosition -{ - ADD_TOP, - ADD_BOTTOM, - ADD_DEFAULT -}; - -enum LLGroupChange -{ - GC_PROPERTIES, - GC_MEMBER_DATA, - GC_ROLE_DATA, - GC_ROLE_MEMBER_DATA, - GC_TITLES, - GC_ALL -}; - -//---------------------------------------------------------------------------- -// DEPRECATED - create new, more specific files for shared enums/constants -//---------------------------------------------------------------------------- - -#endif diff --git a/indra/llcommon/string_table.h b/indra/llcommon/string_table.h deleted file mode 100755 index fe6416fb50..0000000000 --- a/indra/llcommon/string_table.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @file string_table.h - * @brief Legacy wrapper header. - * - * $LicenseInfo:firstyear=2000&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#include "llstringtable.h" diff --git a/indra/llcommon/tests/bitpack_test.cpp b/indra/llcommon/tests/bitpack_test.cpp index afc0c18cd0..9bfd567068 100755 --- a/indra/llcommon/tests/bitpack_test.cpp +++ b/indra/llcommon/tests/bitpack_test.cpp @@ -28,7 +28,7 @@ #include "linden_common.h" -#include "../bitpack.h" +#include "../llbitpack.h" #include "../test/lltut.h" diff --git a/indra/llcommon/timing.h b/indra/llcommon/timing.h deleted file mode 100755 index c408d4c446..0000000000 --- a/indra/llcommon/timing.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @file timing.h - * @brief Cross-platform routines for doing timing. - * - * $LicenseInfo:firstyear=2000&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_TIMING_H -#define LL_TIMING_H - - -#if LL_LINUX || LL_DARWIN || LL_SOLARIS -#include <sys/time.h> -#endif - - -const F32 SEC_TO_MICROSEC = 1000000.f; -const U64 SEC_TO_MICROSEC_U64 = 1000000; -const U32 SEC_PER_DAY = 86400; - -// functionality has been moved lltimer.{cpp,h}. This file will be deprecated in the future. - -#endif |