2000-02-11 22:06:28 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
|
|
|
* Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Simon Fraser <sfraser@netscape.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "nsAETokens.h"
|
|
|
|
|
2000-06-20 23:10:06 +00:00
|
|
|
AETokenDesc::AETokenDesc(const AEDesc* token)
|
|
|
|
: mTokenValid(false)
|
|
|
|
{
|
|
|
|
mTokenValid = (AEGetDescDataSize(token) == sizeof(CoreTokenRecord));
|
|
|
|
if (mTokenValid)
|
|
|
|
AEGetDescData(token, &mTokenData, sizeof(CoreTokenRecord));
|
|
|
|
}
|
|
|
|
|
|
|
|
AETokenDesc::~AETokenDesc() {}
|
|
|
|
|
2000-02-11 22:06:28 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DescType AETokenDesc::GetDispatchClass() const
|
|
|
|
{
|
2000-06-20 23:10:06 +00:00
|
|
|
return (mTokenValid ? mTokenData.dispatchClass : typeNull);
|
2000-02-11 22:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DescType AETokenDesc::GetObjectClass() const
|
|
|
|
{
|
2000-06-20 23:10:06 +00:00
|
|
|
return (mTokenValid ? mTokenData.objectClass : typeNull);
|
2000-02-11 22:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// The field usePropertyCode has been removed from the token record,
|
|
|
|
// so we emulate it here by seeing if the propertyCode field is typeNull,
|
|
|
|
// which is interpreted to mean that this is NOT a property token
|
|
|
|
|
|
|
|
Boolean AETokenDesc::UsePropertyCode() const
|
|
|
|
{
|
2000-06-20 23:10:06 +00:00
|
|
|
return (mTokenValid ? mTokenData.propertyCode != typeNull : false);
|
2000-02-11 22:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DescType AETokenDesc::GetPropertyCode() const
|
|
|
|
{
|
2000-06-20 23:10:06 +00:00
|
|
|
return (mTokenValid ? mTokenData.propertyCode : typeNull);
|
2000-02-11 22:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
long AETokenDesc::GetDocumentID() const
|
|
|
|
{
|
2000-06-20 23:10:06 +00:00
|
|
|
return (mTokenValid ? mTokenData.documentID : typeNull);
|
2000-02-11 22:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
WindowPtr AETokenDesc::GetWindowPtr() const
|
|
|
|
{
|
2000-06-20 23:10:06 +00:00
|
|
|
return (mTokenValid ? mTokenData.window : nil);
|
2000-02-11 22:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
TAEListIndex AETokenDesc::GetElementNumber() const
|
|
|
|
{
|
2000-06-20 23:10:06 +00:00
|
|
|
return (mTokenValid ? mTokenData.elementNumber : 0);
|
2000-02-11 22:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void AETokenDesc::SetPropertyCode(DescType propertyCode)
|
|
|
|
{
|
2000-06-20 23:10:06 +00:00
|
|
|
mTokenData.propertyCode = propertyCode;
|
2000-02-11 22:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
void AETokenDesc::SetDispatchClass(DescType dispatchClass)
|
|
|
|
{
|
2000-06-20 23:10:06 +00:00
|
|
|
mTokenData.dispatchClass = dispatchClass;
|
2000-02-11 22:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
void AETokenDesc::SetObjectClass(DescType objectClass)
|
|
|
|
{
|
2000-06-20 23:10:06 +00:00
|
|
|
mTokenData.objectClass = objectClass;
|
2000-02-11 22:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
void AETokenDesc::SetElementNumber(TAEListIndex number)
|
|
|
|
{
|
2000-06-20 23:10:06 +00:00
|
|
|
mTokenData.elementNumber = number;
|
2000-02-11 22:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
void AETokenDesc::SetWindow(WindowPtr wind)
|
|
|
|
{
|
2000-06-20 23:10:06 +00:00
|
|
|
mTokenData.window = wind;
|
2000-02-11 22:06:28 +00:00
|
|
|
}
|