| 1 | /* |
| 2 | * |
| 3 | * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * Further, this software is distributed without any warranty that it is |
| 16 | * free of the rightful claim of any third person regarding infringement |
| 17 | * or the like. Any license provided herein, whether implied or |
| 18 | * otherwise, applies only to this software file. Patent licenses, if |
| 19 | * any, provided herein do not apply to combinations of this program with |
| 20 | * other software, or any other product whatsoever. |
| 21 | * |
| 22 | * You should have received a copy of the GNU Lesser General Public |
| 23 | * License along with this library; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 | * |
| 26 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, |
| 27 | * Mountain View, CA 94043, or: |
| 28 | * |
| 29 | * http://www.sgi.com |
| 30 | * |
| 31 | * For further information regarding this notice, see: |
| 32 | * |
| 33 | * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ |
| 34 | * |
| 35 | */ |
| 36 | |
| 37 | /* |
| 38 | * Copyright (C) 1995-96 Silicon Graphics, Inc. |
| 39 | * |
| 40 | _______________________________________________________________________ |
| 41 | ______________ S I L I C O N G R A P H I C S I N C . ____________ |
| 42 | | |
| 43 | | $Revision: 1.1.1.1 $ |
| 44 | | |
| 45 | | Classes : SoXtImportInterestList |
| 46 | | |
| 47 | | Author(s) : David Mott |
| 48 | | |
| 49 | ______________ S I L I C O N G R A P H I C S I N C . ____________ |
| 50 | _______________________________________________________________________ |
| 51 | */ |
| 52 | |
| 53 | #include "SoXtImportInterest.h"cxx . . $ `<file>/libSoXt/include/SoXtImportInterest.h`/ |
| 54 | |
| 55 | //////////////////////////////////////////////////////////////////////// |
| 56 | // |
| 57 | // Description: |
| 58 | // Append to the paste interest list. cb will be called when dataType |
| 59 | // is pasted. |
| 60 | // |
| 61 | void |
| 62 | SoXtImportInterestListcxx . . $ SoXtImportInterestList#::appendcxx . . $ SoXtImportInterestList#append(eaa8b8dab1d7e1da).( |
| 63 | Atomcxx . . $ Atom# dataType, SoXtClipboardImportCBcxx . . $ SoXtClipboardImportCB# *cb, void *userData) |
| 64 | // |
| 65 | //////////////////////////////////////////////////////////////////////// |
| 66 | { |
| 67 | // Remove this dataType if already registered |
| 68 | int which = findcxx . . $ SoXtImportInterestList#find(15f694ef3c96d230).(dataType); |
| 69 | removecxx . . $ SoXtImportInterestList#remove(d4f767463ce0a6b3).(which); |
| 70 | |
| 71 | // If cb is set, add it to the list |
| 72 | if (cb != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 73 | SoXtImportInterestcxx . . $ SoXtImportInterest# *data = new SoXtImportInterestcxx . . $ SoXtImportInterest#(dataType, cb, userData); |
| 74 | listcxx . . $ SoXtImportInterestList#list..appendcxx . . $ SbPList#append(5d22bdacc48458e8).(data); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | //////////////////////////////////////////////////////////////////////// |
| 79 | // |
| 80 | // Description: |
| 81 | // Find an entry for the passed dataType in the paste list. |
| 82 | // Returns -1 if no entry found. |
| 83 | // |
| 84 | int |
| 85 | SoXtImportInterestListcxx . . $ SoXtImportInterestList#::findcxx . . $ SoXtImportInterestList#find(15f694ef3c96d230).(Atomcxx . . $ Atom# dataType) |
| 86 | // |
| 87 | //////////////////////////////////////////////////////////////////////// |
| 88 | { |
| 89 | for (int i = 0; i < listcxx . . $ SoXtImportInterestList#list..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) { |
| 90 | SoXtImportInterestcxx . . $ SoXtImportInterest# *data = (SoXtImportInterestcxx . . $ SoXtImportInterest# *) listcxx . . $ SoXtImportInterestList#list.[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i]; |
| 91 | if (data->getDataTypecxx . . $ SoXtImportInterest#getDataType(fe4d2d262d4164a8).() == dataType) |
| 92 | return i; |
| 93 | } |
| 94 | |
| 95 | return -1; |
| 96 | } |
| 97 | |
| 98 | //////////////////////////////////////////////////////////////////////// |
| 99 | // |
| 100 | // Description: |
| 101 | // Remove the passed entry from the paste interest list. |
| 102 | // |
| 103 | void |
| 104 | SoXtImportInterestListcxx . . $ SoXtImportInterestList#::removecxx . . $ SoXtImportInterestList#remove(d4f767463ce0a6b3).(int which) |
| 105 | // |
| 106 | //////////////////////////////////////////////////////////////////////// |
| 107 | { |
| 108 | if (which >= 0 && which < listcxx . . $ SoXtImportInterestList#list..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).()) { |
| 109 | SoXtImportInterestcxx . . $ SoXtImportInterest# *data = (SoXtImportInterestcxx . . $ SoXtImportInterest# *) listcxx . . $ SoXtImportInterestList#list.[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).which]; |
| 110 | delete data; |
| 111 | listcxx . . $ SoXtImportInterestList#list..removecxx . . $ SbPList#remove(d4f767463ce0a6b3).(which); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | //////////////////////////////////////////////////////////////////////// |
| 116 | // |
| 117 | // Description: |
| 118 | // Return the interest data for 'which' item in the list. |
| 119 | // |
| 120 | const SoXtImportInterestcxx . . $ SoXtImportInterest# * |
| 121 | SoXtImportInterestListcxx . . $ SoXtImportInterestList#::getcxx . . $ SoXtImportInterestList#get(f16160081ce57915).(int which) |
| 122 | // |
| 123 | //////////////////////////////////////////////////////////////////////// |
| 124 | { |
| 125 | if (which >= 0 && which < listcxx . . $ SoXtImportInterestList#list..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).()) |
| 126 | return (SoXtImportInterestcxx . . $ SoXtImportInterest# *) listcxx . . $ SoXtImportInterestList#list.[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).which]; |
| 127 | else return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 128 | } |
| 129 | |
| 130 | //////////////////////////////////////////////////////////////////////// |
| 131 | // |
| 132 | // Description: |
| 133 | // Return the data type for 'which' item in the list. |
| 134 | // |
| 135 | Atomcxx . . $ Atom# |
| 136 | SoXtImportInterestListcxx . . $ SoXtImportInterestList#::getDataTypecxx . . $ SoXtImportInterestList#getDataType(c104ebd7d68b2193).(int which) |
| 137 | // |
| 138 | //////////////////////////////////////////////////////////////////////// |
| 139 | { |
| 140 | const SoXtImportInterestcxx . . $ SoXtImportInterest# *data = getcxx . . $ SoXtImportInterestList#get(f16160081ce57915).(which); |
| 141 | if (data != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 142 | return data->getDataTypecxx . . $ SoXtImportInterest#getDataType(fe4d2d262d4164a8).(); |
| 143 | else return 0; |
| 144 | } |
| 145 |